GVN: tolerate an instruction being replaced without existing in the leaderboard
authorTim Northover <tnorthover@apple.com>
Tue, 14 Jul 2015 21:03:18 +0000 (21:03 +0000)
committerTim Northover <tnorthover@apple.com>
Tue, 14 Jul 2015 21:03:18 +0000 (21:03 +0000)
commit0e34491fef992460fbfbe7d790e13bcd6d01ccb1
tree0425aafa4f4e390e7873b50f57406bbc342cf241
parente1bb5354220459e7d441a240855f5f60c561003b
GVN: tolerate an instruction being replaced without existing in the leaderboard

Sometimes an incidentally created instruction can duplicate a Value used
elsewhere. It then often doesn't end up in the leader table. If it's later
removed, we attempt to remove it from the leader table and segfault.

Instead we should just ignore the removal request, which won't cause any
problems. The reverse situation, where the original instruction is replaced by
the new one (which you might think could leave the leader table empty) cannot
occur, because the incidental instruction will never be found in the first
place.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242199 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/GVN.cpp
test/Transforms/GVN/pre-new-inst.ll [new file with mode: 0644]