[llvm] r178031 - Make InstCombineCasts.cpp:OptimizeIntToFloatBitCast endian safe.

Duncan Sands baldrick at free.fr
Tue Mar 26 09:04:17 PDT 2013


Hi Ulrich,

On 26/03/13 16:36, Ulrich Weigand wrote:
> Author: uweigand
> Date: Tue Mar 26 10:36:14 2013
> New Revision: 178031
>
> URL: http://llvm.org/viewvc/llvm-project?rev=178031&view=rev
> Log:
> Make InstCombineCasts.cpp:OptimizeIntToFloatBitCast endian safe.
...

the testcase seems to be missing.

> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp (original)
> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp Tue Mar 26 10:36:14 2013
> @@ -1610,6 +1610,9 @@ static Value *OptimizeIntegerToVectorIns
>   /// OptimizeIntToFloatBitCast - See if we can optimize an integer->float/double
>   /// bitcast.  The various long double bitcasts can't get in here.
>   static Instruction *OptimizeIntToFloatBitCast(BitCastInst &CI,InstCombiner &IC){
> +  // We need to know the target byte order to perform this optimization.
> +  if (!IC.getDataLayout()) return 0;
> +

I think DataLayout is only needed in the vector case, so how about testing it
later when the code is treating the vector case, and do the bailing out there.
That way the non-vector case will still be optimized if there is no target data.

>     Value *Src = CI.getOperand(0);
>     Type *DestTy = CI.getType();
>

Ciao, Duncan.




More information about the llvm-commits mailing list