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)
commitd5fdef016d0d957d8712b07e9e5828b9dae5c944
treec85eb355ff9cadeb617ed19c532d373dcd347af5
parentd30e2eefc3cf8dfd2210aefd62f13a6e7c011b43
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.

llvm-svn: 242199
llvm/lib/Transforms/Scalar/GVN.cpp
llvm/test/Transforms/GVN/pre-new-inst.ll [new file with mode: 0644]