[PATCH] Make InstCombineCasts.cpp:OptimizeIntToFloatBitCast endian safe

Chris Lattner clattner at apple.com
Tue Mar 26 14:40:17 PDT 2013


Looks great, thanks for committing this!

On Mar 26, 2013, at 4:12 AM, Ulrich Weigand <Ulrich.Weigand at de.ibm.com> wrote:

> Chris Lattner <clattner at apple.com> wrote on 26.03.2013 00:19:59:
>> On Mar 25, 2013, at 12:58 PM, Ulrich Weigand
>> <Ulrich.Weigand at de.ibm.com> wrote:
>>> 
>>> The computation of "Elt" above looks to be correct only for
> little-endian
>>> platforms ...
>>> 
>>> If I disable the whole OptimizeIntToFloatBitCast optimization, I get
> the
>>> correct result again.
>> 
>> Yes, this does look endian unsafe.  I'd be fine with you disabling
>> this when targeting a big-endian system.  It would be nice to
>> generalize the code, but it isn't critical at all.
> 
> Hmm, this seems to be relatively straightforward after all.
> The attached patch fixes the problem for me, and keeps the
> optimization enabled for big-endian platforms as well.
> 
> OK to commit?
> 
> Bye,
> Ulrich
> 
> (See attached file: diff-llvm-instcombine-endianfix)<diff-llvm-instcombine-endianfix>




More information about the llvm-commits mailing list