InstSimplify: Don't simplify gep X, (Y-X) to Y if types differ
authorDavid Majnemer <david.majnemer@gmail.com>
Wed, 27 Aug 2014 20:08:34 +0000 (20:08 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Wed, 27 Aug 2014 20:08:34 +0000 (20:08 +0000)
commit48164ed24df7df33e416b83d40135ad97a6db489
treefc42d0b31fd270149c909887b455c33ac6fd0567
parent1c768816d7bef592d9922569501cbab663d2cae7
InstSimplify: Don't simplify gep X, (Y-X) to Y if types differ

It's incorrect to perform this simplification if the types differ.
A bitcast would need to be inserted for this to work.

This fixes PR20771.

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