[LLVMdev] a constant folding case causing different results w/ot optimization

Chris Lattner clattner at apple.com
Mon Dec 7 20:58:37 PST 2009

On Dec 7, 2009, at 4:50 PM, Eli Friedman wrote:

> On Mon, Dec 7, 2009 at 3:51 PM, Zheng, Bixia <Bixia.Zheng at amd.com> wrote:
>> While the result of “(unsigned int) -1.0f” is probably implementation
>> defined, both gcc and Microsoft cl produce -1.
> LLVM (and C/C++) consider the result to be undefined (i.e. it can
> produce anything).  And it can actually produce results other than -1
> on some platforms supported by LLVM.  So I don't see any good reason
> to choose your way of folding it over the current method.

Yes.  If you're interested in improving this, folding it to undef would be better than to 0.


More information about the llvm-dev mailing list