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

Duncan Sands baldrick at free.fr
Sun Mar 4 05:03:09 PST 2012


Hi Rafael,

On 04/03/12 13:59, Rafael EspĂ­ndola wrote:
>> The most important thing for me is that dominance of blocks and dominance of instructions follow the same rules.  Beyond that, I'm pretty ok with anything.  If you think that returning true makes sense, feel free to make it so (just don't break anything ;-)
>
> OK, so the definition of dominates(BBA, BBB) would become:
>
> dominates(BBA, BBB) is true iff  any definition in BBA would dominate
> any use in BBB. With the note that an invoke in BBA is not a
> definition in BBA (it is on the normal edge) and a phi in BBB is not a
> use in BBB (it is on the predecessors).

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

Ciao, Duncan.



More information about the llvm-commits mailing list