diff options
author | Nadav Rotem <nrotem@apple.com> | 2012-11-02 21:47:47 +0000 |
---|---|---|
committer | Nadav Rotem <nrotem@apple.com> | 2012-11-02 21:47:47 +0000 |
commit | 919b5aab3417aa570d102566a85693d0b6941c25 (patch) | |
tree | d2c0dac5cf45fb610b603d153fd05f0c45e4c5d9 /llvm/lib/Target/TargetTransformImpl.cpp | |
parent | 6dcf75897cbacb6f9ea48d44f52cf6ef3f2df055 (diff) | |
download | llvm-919b5aab3417aa570d102566a85693d0b6941c25.zip llvm-919b5aab3417aa570d102566a85693d0b6941c25.tar.gz llvm-919b5aab3417aa570d102566a85693d0b6941c25.tar.bz2 |
Scalar Bitcasts and Truncs are usually free
llvm-svn: 167323
Diffstat (limited to 'llvm/lib/Target/TargetTransformImpl.cpp')
-rw-r--r-- | llvm/lib/Target/TargetTransformImpl.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Target/TargetTransformImpl.cpp b/llvm/lib/Target/TargetTransformImpl.cpp index dbbf37a..4cd07cd 100644 --- a/llvm/lib/Target/TargetTransformImpl.cpp +++ b/llvm/lib/Target/TargetTransformImpl.cpp @@ -213,6 +213,11 @@ unsigned VectorTargetTransformImpl::getCastInstrCost(unsigned Opcode, Type *Dst, // Handle scalar conversions. if (!Src->isVectorTy() && !Dst->isVectorTy()) { + + // Scalar bitcasts and truncs are usually free. + if (Opcode == Instruction::BitCast || Opcode == Instruction::Trunc) + return 0; + // Just check the op cost. If the operation is legal then assume it costs 1. if (!TLI->isOperationExpand(ISD, DstLT.second)) return 1; |