projects
/
platform
/
upstream
/
llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6dcf758
)
Scalar Bitcasts and Truncs are usually free
author
Nadav Rotem
<nrotem@apple.com>
Fri, 2 Nov 2012 21:47:47 +0000
(21:47 +0000)
committer
Nadav Rotem
<nrotem@apple.com>
Fri, 2 Nov 2012 21:47:47 +0000
(21:47 +0000)
llvm-svn: 167323
llvm/lib/Target/TargetTransformImpl.cpp
patch
|
blob
|
history
diff --git
a/llvm/lib/Target/TargetTransformImpl.cpp
b/llvm/lib/Target/TargetTransformImpl.cpp
index
dbbf37a
..
4cd07cd
100644
(file)
--- 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;