[BDCE] Don't forget uses of root instructions seen before the instruction itself
authorHal Finkel <hfinkel@anl.gov>
Wed, 18 Feb 2015 03:12:28 +0000 (03:12 +0000)
committerHal Finkel <hfinkel@anl.gov>
Wed, 18 Feb 2015 03:12:28 +0000 (03:12 +0000)
commit8a85dee9896864cf22316593face0db35718abeb
tree384c301a2776c393a94675ab8ab34df879c93e42
parent333507b7af11c69a8ca8dfefdc9a1cbd71c31353
[BDCE] Don't forget uses of root instructions seen before the instruction itself

When visiting the initial list of "root" instructions (those which must always
be alive), for those that are integer-valued (such as invokes returning an
integer), we mark their bits as (initially) all dead (we might, obviously, find
uses of those bits later, but all bits are assumed dead until proven
otherwise). Don't do so, however, if we're already seen a use of those bits by
another root instruction (such as a store).

Fixes a miscompile of the sanitizer unit tests on x86_64.

Also, add a debug line for visiting the root instructions, and remove a debug
line which tried to print instructions being removed (printing dead
instructions is dangerous, and can sometimes crash).

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