InstCombine: Fix infinite loop when encountering switch on trivial icmp.
authorBenjamin Kramer <benny.kra@googlemail.com>
Mon, 28 May 2012 19:18:16 +0000 (19:18 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Mon, 28 May 2012 19:18:16 +0000 (19:18 +0000)
commitb8743a9150ea41edd8b076f3fd4eb004d3b1350f
treec687933f475edb39ba57c8c1ecdaae075d82ff4b
parent1ab17ed57e388450a2fb4465c69894353b9caa40
InstCombine: Fix infinite loop when encountering switch on trivial icmp.

The test case feeds the following into InstCombine's visitSelect:
%tobool8 = icmp ne i32 0, 0
%phitmp = select i1 %tobool8, i32 3, i32 0
Then instcombine replaces the right side of the switch with 0, doesn't notice
that nothing changes and tries again indefinitely.

This fixes PR12897.

llvm-svn: 157587
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
llvm/test/Transforms/InstCombine/2012-05-28-select-hang.ll [new file with mode: 0644]