llvm.org GIT mirror llvm / 955cf53
Use the isTruncFree and isZExtFree API to figure out of these operations are free. Thanks Andy! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167685 91177308-0d34-0410-b5e6-96231b3b80d8 Nadav Rotem 7 years ago
1 changed file(s) with 10 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
213213 // Handle scalar conversions.
214214 if (!Src->isVectorTy() && !Dst->isVectorTy()) {
215215
216 // Scalar bitcasts and truncs are usually free.
217 if (Opcode == Instruction::BitCast || Opcode == Instruction::Trunc)
216 // Scalar bitcasts are usually free.
217 if (Opcode == Instruction::BitCast)
218 return 0;
219
220 if (Opcode == Instruction::Trunc &&
221 TLI->isTruncateFree(SrcLT.second, DstLT.second))
222 return 0;
223
224 if (Opcode == Instruction::ZExt &&
225 TLI->isZExtFree(SrcLT.second, DstLT.second))
218226 return 0;
219227
220228 // Just check the op cost. If the operation is legal then assume it costs 1.