How to determine the most-immediate dominator from a set?

Hi llvm-dev,

Given an instruction, is there a standard way in llvm, such as a function or

methodology, to determine its most-immediate dominator from a set?

Many thanks,


Hi Orlando,

If I understand correctly, you should be able to use DT::findNearestCommonDominator [1]. Because this function takes 2 blocks at a time, you’d need to call it in a loop. Basically NCD(B1, B2, B3, …) = NCD(NCD(B1, B2), B3, …).



That looks useful, thanks for the help.