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)
commite5742464895b7f1fcc6a5b968b72f6ec66a1fd44
tree4813758eebc6458e266fe664c5f503d6db147546
parent41d35a335efb30710c0ad806833379fe0373c7a0
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173356 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ConstantFolding.cpp
test/Transforms/ConstProp/2007-11-23-cttz.ll
test/Transforms/InstCombine/intrinsics.ll