Fix an infinite loop in InstCombine when an instruction with no users and side effect...
authorOwen Anderson <resistor@mac.com>
Tue, 10 Mar 2015 05:13:47 +0000 (05:13 +0000)
committerOwen Anderson <resistor@mac.com>
Tue, 10 Mar 2015 05:13:47 +0000 (05:13 +0000)
commit645fd68c5c2513c467590d5e07dd8951c1c4c8d4
tree24dbfe57e4e71b4a5d8f4762e051cd4d9f801c25
parentcf08570476011470501f43636f04d2f26b9ac951
Fix an infinite loop in InstCombine when an instruction with no users and side effects can be constant folded.

ReplaceInstUsesWith needs to return nullptr when the input has no users,
because in that case it does not mutate the program.  Otherwise, we can
get stuck in an infinite loop of repeatedly attempting to constant fold
and instruction with no users.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231755 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineInternal.h
test/Transforms/InstCombine/constant-fold-hang.ll [new file with mode: 0644]