[llvm-commits] [llvm] r151466 - in /llvm/trunk: include/llvm/Analysis/Dominators.h lib/Analysis/InstructionSimplify.cpp

Rafael Espíndola rafael.espindola at gmail.com
Sun Mar 4 13:16:57 PST 2012


> I don't think this is the right way round.  Domination between basic blocks
> is the fundamental concept, domination of instructions should be built on
> top of it.  I think the definition of dominates for basic blocks should be:
> A dominates B iff every path from the entry block to B necessarily passes
> via A.  This results in the right properties wrt instructions too.  This
> definition doesn't change anything for reachable basic blocks, however
> for unreachable blocks you get:
>  dominates(anything, unreachable) -> true
>  dominates(unreachable, reachable) -> false

I would probably keep the implementation that way (dominates
instruction calls to dominates bb). I just find it a bit easier to
think in term of individual defs and uses because of the peculiar
point of definition and use that some instructions have. With you
definition, what would the result be for

* dominates(unreachable, unreachable)
* dominates(BBA,BBA)

My understanding is that we would like to assert on the first one and
return false for the second one, right?

> Ciao, Duncan.

Cheers,
Rafael




More information about the llvm-commits mailing list