[llvm-commits] [llvm] r167323 - /llvm/trunk/lib/Target/TargetTransformImpl.cpp

Andrew Trick atrick at apple.com
Fri Nov 9 14:48:11 PST 2012


On Nov 2, 2012, at 2:47 PM, Nadav Rotem <nrotem at apple.com> wrote:

> 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;

TLI->isTruncateFree?

-Andy



More information about the llvm-commits mailing list