[clang] [clang][FlowSensitive] Do a quick check and bail early for massive CFGs (PR #186808)

Jan Voung via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 18 07:51:20 PDT 2026


================
@@ -479,6 +481,27 @@ transferCFGBlock(const CFGBlock &Block, AnalysisContext &AC,
   return State;
 }
 
+// Returns the number of blocks that would be visited if we only visit each
+// reachable block once. This provides a lower bound on the number of block
+// visits. This is a light version of the main analysis loop (keep in sync).
+size_t NumBlockVisitsIfVisitEachReachableOnce(const CFG &CFG) {
----------------
jvoung wrote:

It is similar, but counts blocks the way that the analysis loop does (e.g., not counting the entry block). 

Did you mean to reuse some other reachable block counting functionality? I looked but didn't see one.

Otherwise, I wanted this to be as close to what the analysis loop does to be "NFC", but with high enough MaxBlockVisits it could be close enough.



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


More information about the cfe-commits mailing list