Reproducer:
; RUN: opt -S -jump-threading < %s
define void @test() {
entry:
br i1 false, label %loop, label %exit
loop:
%bool = phi i1 [ %xor, %loop.latch ], [ false, %entry ]
%cmp = icmp eq i16 0, 1
%xor = xor i1 %cmp, %bool
br i1 %bool, label %loop.latch, label %exit
loop.latch:
%dummy = phi i16 [ 0, %loop ]
br label %loop
exit:
ret void
}On this occassion, phi node %bool is actually %xor, and doing substitution causes assertion failure.