How to find if an instruction post-dominates another in LLVM?

1.1k views Asked by At

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?

1

There are 1 answers

1
PaulR On BEST ANSWER

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 >".