Fix PR13412, a nasty miscompile due to the interleaved
authorChandler Carruth <chandlerc@gmail.com>
Tue, 7 Aug 2012 10:59:59 +0000 (10:59 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Tue, 7 Aug 2012 10:59:59 +0000 (10:59 +0000)
commit961e1acfb275613679c0d00d4a0b4ed394b51a9d
tree09ed55ad41b901e58f64a5837626733e7a10b725
parente6450dc2afc18531bf9b70180a9f67376d9f00c7
Fix PR13412, a nasty miscompile due to the interleaved
instsimplify+inline strategy.

The crux of the problem is that instsimplify was reasonably relying on
an invariant that is true within any single function, but is no longer
true mid-inline the way we use it. This invariant is that an argument
pointer != a local (alloca) pointer.

The fix is really light weight though, and allows instsimplify to be
resiliant to these situations: when checking the relation ships to
function arguments, ensure that the argumets come from the same
function. If they come from different functions, then none of these
assumptions hold. All credit to Benjamin Kramer for coming up with this
clever solution to the problem.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161410 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/InstructionSimplify.cpp
test/Transforms/Inline/inline_constprop.ll