NewGVN gets stuck in a infinite loop for the following test case.
define void @foo() { br label %1 1: %2 = phi i32 [ %3, %1 ], [ undef, %0 ] %3 = lshr i32 %2, 973496514 br label %1
With the following steps:
%2 -> undef (edge <%1, %1> is initially unreachable) %3 -> 0 ; start of evaluation loop %2 -> phi [0, undef] %3 -> poison %2 -> phi [poison, undef] -> undef %3 -> 0 ; repeat
The problem here is that poison and undef simplify differently and we have a cyclic dependency, so the value numbering never converges.
Not ignoring the poison breaks the cycle.
this could be folded to just undef.