Roberto Rosmaninho
Roberto Rosmaninho

Reputation: 1

How to know if a Basic Block PostDominate another one?

I'm trying to write an analysis and one of the features that I need is to know if a node PostDominate another.

I already know that I have to use:

void LazyProfitability::getAnalysisUsage(AnalysisUsage &AU) const {
   AU.addRequired<PostDominatorTreeWrapperPas>();
   AU.setPreservesAll();
}

Upvotes: 0

Views: 240

Answers (1)

Valeriy Savchenko
Valeriy Savchenko

Reputation: 1614

You can get a PostDominatorTree object from the analysis results:

auto PDT = &getAnalysis<PostDominatorTreeWrapperPass>().getPostDomTree();

And use it after that in the following manner:

// returns true iff A post-dominates B
PDT->dominates(A, B);

Upvotes: 1

Related Questions