Jump Theading/GVN bug

Rafael Espíndola rafael.espindola at gmail.com
Mon Feb 23 07:38:24 PST 2015


>> This instruction doesn’t appear to be well formed. However, one could
>> argue that it is – formally %2 def does dominate all %2 uses because both
>> are located in an unreachable block, so every path to the use is passing
>> through the def (because there are 0 paths like that).
>>
>> That is likely the reason why –verify doesn’t complain about it.
>
>
> Why is jump-threading creating this funky instruction?

It is well formed. I agree with Hal: it might be a quality improvement
to generate tidier IR from jump-threading, but GVN has to handle
whatever input passes the verifier.

The GVN crashes reduces to just running GVN in

define i8 @foo(i8* %x) {
bb0:
  br label %bb2
bb1:
  %tmp1 = getelementptr inbounds i8* %tmp1, i64 1
  br i1 false, label %bb2, label %bb1
bb2:
  %tmp2 = phi i8* [ %tmp1, %bb1 ], [ %x, %bb0 ]
  %tmp3 = load i8* %tmp2, align 1
  ret i8 %tmp3
}

Cheers,
Rafael




More information about the llvm-commits mailing list