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

Duncan Sands baldrick at free.fr
Fri Mar 2 12:44:21 PST 2012


Hi Rafael,

> Don't call dominates on unreachable instructions.

why not?  Is there really no sensible definition of domination in this case?
For example, consider dominates(A, B).  Suppose the definition is: every path
from the entry block to B passes through A.  Then if B is unreachable then
dominates should return 'true'.  After all, every path from the entry block to
B passes through A.  (If you don't agree, show me a path from the entry block
to B that doesn't pass through A).  If B is reachable and A is unreachable,
then dominates should return 'true' since there is a path from the entry
block to B that doesn't pass through A.  But perhaps you have a different
definition of domination in mind?

Ciao, Duncan.

PS: If you add an assertion about dominates(instruction,instruction) only
being called for reachable instructions, then shouldn't you have one for
dominates(basic block, basic block) too?  After all, if you think
dominates(instruction,instruction) has no sensible meaning, probably
dominates(basic block, basic block) has no sensible meaning either.



More information about the llvm-commits mailing list