[clang] [clang][analysis][dataflow] Detect goto backedges to trigger Widen (PR #179546)
Jan Voung via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 6 07:48:35 PST 2026
================
@@ -64,14 +69,23 @@ static int blockIndexInPredecessor(const CFGBlock &Pred,
return BlockPos - Pred.succ_begin();
}
-// A "backedge" node is a block introduced in the CFG exclusively to indicate a
-// loop backedge. They are exactly identified by the presence of a non-null
-// pointer to the entry block of the loop condition. Note that this is not
-// necessarily the block with the loop statement as terminator, because
-// short-circuit operators will result in multiple blocks encoding the loop
-// condition, only one of which will contain the loop statement as terminator.
-static bool isBackedgeNode(const CFGBlock &B) {
- return B.getLoopTarget() != nullptr;
+// Given a backedge from B1 to B2, B1 is a "backedge node" in a CFG.
----------------
jvoung wrote:
That sounds reasonable to me.
I kept "hasGotoInCFG" out of the interface (static), since that seemed less clear it is useful as a public API.
https://github.com/llvm/llvm-project/pull/179546
More information about the cfe-commits
mailing list