Dminator set question

How can I get the dominator set for each basicblock in a function

LLVM has a DominatorTree analysis pass that might be useful: I also recall an actual Dominator analysis pass in previous versions of LLVM, but I’m unsure if it still exists in mainline LLVM. I think it was replaced by some new facility in the VMCore library. – John T.

Seems you have the same problem as [1]? Perhaps you can refer to [2]
to see how to define your own pass and use getAnalysis template to get
the function's dominator tree.