[llvm-commits] [llvm] r167323 - /llvm/trunk/lib/Target/TargetTransformImpl.cpp
Nadav Rotem
nrotem at apple.com
Fri Nov 2 14:47:47 PDT 2012
Author: nadav
Date: Fri Nov 2 16:47:47 2012
New Revision: 167323
URL: http://llvm.org/viewvc/llvm-project?rev=167323&view=rev
Log:
Scalar Bitcasts and Truncs are usually free
Modified:
llvm/trunk/lib/Target/TargetTransformImpl.cpp
Modified: llvm/trunk/lib/Target/TargetTransformImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetTransformImpl.cpp?rev=167323&r1=167322&r2=167323&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetTransformImpl.cpp (original)
+++ llvm/trunk/lib/Target/TargetTransformImpl.cpp Fri Nov 2 16:47:47 2012
@@ -213,6 +213,11 @@
// 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;
More information about the llvm-commits
mailing list