[LLVMdev] Jump Theading/GVN bug - moving discussion to llvm-dev

Rafael Espíndola
Fri, 27 Feb 2015 14:24:35 -0000

>> define void @f() {
>> bb0:
>>    ret void
>> bb1:
>>    %a = getelementptr inbounds i8* %b, i64 1
>>    ret void
>> bb2:
>>    %b = getelementptr inbounds i8* %a, i64 1
>>    ret void
>> }
>>
>> Since bb1 dominates bb2 and bb2 dominates bb1, no?
>
> I think this a great example of how our current definition is nonsensical
> and confusing.  :)

It is. It is just hard to come up with a definition that doesn't just hide
the
confusion in a slightly more complicated case. Except:

> What would be implications of making dominates assert is given an
> unreachable block?  This seems like it would help isolate a lot of bugs.
> Callers need to know about unreachable blocks anyways, so why not just make
> that explicit?

That is, making (A dominates B) undefined if A is unreachable. To be clear,
you propose changing only the utility function that passes use, correct?
The verifier would still use the current version and @f above would still
be considered valid.

It is probably worth the experiment :-)

Cheers,
Rafael