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

Sanjoy Das sanjoy at playingwithpointers.com
Tue Feb 24 11:08:57 PST 2015


> The only use of dominance information I can find in JT/LVI is for the
> handling for @llvm.assume in ValueTracking.  Adding a
> DT->isReachableFromEntry check to this path seems downright simple.

Passes tend to implicitly depend on the dominator tree on actually
being a tree -- that is the justification for recursing on the operand
of a non-PHI instruction and expecting the recursion to terminate.  If
you allow unreachable blocks then you can have cycles (disconnected
from the root) in the dom "tree" and such recursion is not
well-founded.  AFAICT, that is the fundamental reason why OP's example
hangs in GVN.

I'd say Hal's proposal (2) can be precisely stated as "no cycles are
allowed in the dom tree" or "every component of the dom tree is
acyclic".  That gets rid of most nonsense instructions like "%a = add
%a, %a" and recursion on operands of non-PHIs are well-founded.

-- Sanjoy



More information about the llvm-dev mailing list