Fix a problem with incomplete equality testing of PHINodes in
authorJoel Jones <joel_k_jones@apple.com>
Thu, 10 May 2012 15:59:41 +0000 (15:59 +0000)
committerJoel Jones <joel_k_jones@apple.com>
Thu, 10 May 2012 15:59:41 +0000 (15:59 +0000)
commit9df72a93ef27a27c6853eed3ed92c9e0b62c9ca6
tree6af1907b215463aeb652ff2bc6488082e0ff23d5
parentb88e8dd31d1364d288d970f9187342a33b8de149
Fix a problem with incomplete equality testing of PHINodes in
Instruction::IsIdenticalToWhenDefined.

This manifested itself when inlining two calls to the same function.  The
inlined function had a switch statement that returned one of a set of
global variables.  Without this modification, the two phi instructions that
chose values from the branches of the switch instruction inlined from the
callee were considered equivalent and jump-threading replaced a load for the
first switch value with a phi selecting from the second switch, thereby
producing incorrect code.

This patch has been tested with "make check-all", "lnt runteste nt", and
llvm self-hosted, and on the original program that had this problem,
wireshark.

<rdar://problem/11025519>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156548 91177308-0d34-0410-b5e6-96231b3b80d8
lib/VMCore/Instruction.cpp
test/Transforms/JumpThreading/phi-eq.ll [new file with mode: 0644]