[LLVMdev] a constant folding case causing different results w/ot optimization
Zheng, Bixia
Bixia.Zheng at amd.com
Mon Dec 7 15:51:54 PST 2009
Hi,
The optimizer folds "(unsigned int) -1.0f" to 0. As a result, the
following routine foo returns 0 with optimization, and returns -1
(0xffffffff) without optimization.
unsigned int foo()
{
float myfloat = -1.0f;
unsigned int myint = (unsigned int) myfloat;
return myint;
}
INSTCOMBINE ITERATION #0 on
IC: ConstFold to: i32 0 from: %conv = fptoui float -1.000000e+000 to
i32 ; <i32> [#uses=1]
While the result of "(unsigned int) -1.0f" is probably implementation
defined, both gcc and Microsoft cl produce -1.
Will you consider this an optimizer bug and fix it?
Thanks,
bixia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091207/b04a7a8f/attachment.html>
More information about the llvm-dev
mailing list