[llvm] [CSSPGO] [Pseudo-Probe] Avoid infinite loop on cyclic invoke destinations (PR #221630)

chandan singh via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 15 21:51:18 PDT 2026


================
@@ -0,0 +1,32 @@
+; RUN: opt < %s -passes=pseudo-probe -S | FileCheck %s
+
+; getOriginalTerminator walks invoke normal destinations. If that chain is a
+; cycle (self-looping invoke), the walk must stop. This CFG hangs without
+; cycle detection.
+;
+; Matches clang++ -O2 -fexceptions on: try { for (;;) f1(); } catch (...) {}
+define void @self_looping_invoke() personality ptr @__gxx_personality_v0 {
+; CHECK-LABEL: define void @self_looping_invoke(
+entry:
+; CHECK:      entry:
+; CHECK:        call void @llvm.pseudoprobe
+; CHECK-NEXT:   br label %loop
+  br label %loop
+
+loop:
+; CHECK:      loop:
----------------
chandankds wrote:

yes, thank you for catching this. I've made the required change to probe this BB as well.

https://github.com/llvm/llvm-project/pull/221630


More information about the llvm-commits mailing list