[llvm] [AMDGPU][FixIrreducible][UnifyLoopExits] Support callbr with inline-asm (PR #149308)
Robert Imschweiler via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 29 03:55:21 PDT 2025
================
@@ -79,6 +79,53 @@
// Limitation: The pass cannot handle switch statements and indirect
// branches. Both must be lowered to plain branches first.
//
+// CallBr support: CallBr is handled as a more general branch instruction which
+// can have multiple successors. The pass redirects the edges to intermediate
+// target blocks that unconditionally branch to the original callbr target
+// blocks. This allows the control flow hub to know to which of the original
+// target blocks to jump to.
+// Example input CFG:
+// Entry (callbr)
+// / \
+// v v
+// H ----> B
+// ^ /|
+// `----' |
+// v
+// Exit
+//
+// becomes:
+// Entry (callbr)
+// / \
+// v v
+// target.H target.B
+// | |
+// v v
+// H ----> B
+// ^ /|
+// `----' |
+// v
+// Exit
----------------
ro-i wrote:
What I'm doing with callbr in this context is not really related to critical edges, I think. The added blocks between callbr and its original target blocks only facilitate the callbr handling. So that you know to which callbr target you should branch to from the control flow hub (that is being introduced by FixIrreducible/UnifyLoopExits).
https://github.com/llvm/llvm-project/pull/149308
More information about the llvm-commits
mailing list