Fix logical error when detecting lifetime intrinsics.
authorNick Lewycky <nicholas@mxc.ca>
Wed, 3 Aug 2011 00:43:35 +0000 (00:43 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Wed, 3 Aug 2011 00:43:35 +0000 (00:43 +0000)
commitd5061a9268d04c80af764291ef93fe3f7b51f0de
treed63baa440ac792dfe074875195844787e53420db
parent19308a1ea1c34e3dbed7b801408b2a8fcaba73f5
Fix logical error when detecting lifetime intrinsics.

Don't replace a gep/bitcast with 'undef' because that will form a "free(undef)"
which in turn means "unreachable". What we wanted was a no-op. Instead, analyze
the whole tree and look for all the instructions we need to delete first, then
delete them second, not relying on the use_list to stay consistent.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136752 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstructionCombining.cpp
test/Transforms/InstCombine/malloc-free-delete.ll