ConstantFolding: Add a missing folding that leads to a miscompile.
authorBenjamin Kramer <benny.kra@googlemail.com>
Thu, 24 Jan 2013 16:28:28 +0000 (16:28 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Thu, 24 Jan 2013 16:28:28 +0000 (16:28 +0000)
commit435eba09b75dc64a0e3a1b39953c1ddc3ef0de7c
treee73818da30d62c176e72727d1a0424b48ab0e7a0
parentcbc86bcbb59e9db635600d1aba277413bb09d0cb
ConstantFolding: Add a missing folding that leads to a miscompile.

We use constant folding to see if an intrinsic evaluates to the same value as a
constant that we know. If we don't take the undefinedness into account we get a
value that doesn't match the actual implementation, and miscompiled code.

This was uncovered by Chandler's simplifycfg changes.

llvm-svn: 173356
llvm/lib/Analysis/ConstantFolding.cpp
llvm/test/Transforms/ConstProp/2007-11-23-cttz.ll
llvm/test/Transforms/InstCombine/intrinsics.ll