Using the llvm::DominatorTree
class, you can find out if an instruction dominates another. The necessary functions to do so are available: see
http://llvm.org/doxygen/classllvm_1_1DominatorTree.html
DT = DominatorTree(Func);
...
...
DT.dominates(I1,I2);
However, the same functions are not available for the llvm::PostDominatorTree
struct. In fact, the latter's doxygen page is almost empty:
http://llvm.org/doxygen/structllvm_1_1PostDominatorTree.html
Is there a way to check postdominance as easily as dominance in LLVM?
Most of PostDominatorTree
's methods are inherited from DominatorTreeBase
, including dominates
. So this works the same as with llvm::DominatorTree
You find the doxygen documentation under "Public Member Functions inherited from llvm::DominatorTreeBase< NodeT, IsPostDom >
".