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

Eli Friedman eli.friedman at gmail.com
Mon Dec 7 16:50:01 PST 2009


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.

-Eli




More information about the llvm-dev mailing list