[llvm-dev] How to determine the most-immediate dominator from a set?

15 views
Skip to first unread message

Cazalet-Hyams, Orlando via llvm-dev

unread,
Oct 21, 2020, 11:03:13 AM10/21/20
to llvm...@lists.llvm.org

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,

Orlando

Jakub (Kuba) Kuderski via llvm-dev

unread,
Oct 21, 2020, 3:09:26 PM10/21/20
to Cazalet-Hyams, Orlando, llvm...@lists.llvm.org
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, ...).

Sincerely,
Jakub

[1] https://llvm.org/doxygen/classllvm_1_1DominatorTreeBase.html#af555c3593d46d5f057fbebc8d292eac8

_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


--
Jakub Kuderski

Cazalet-Hyams, Orlando via llvm-dev

unread,
Oct 22, 2020, 4:31:19 AM10/22/20
to Jakub (Kuba) Kuderski, llvm...@lists.llvm.org

That looks useful, thanks for the help.

Orlando

Reply all
Reply to author
Forward
0 new messages