[clang] [clang][dataflow] Drop block-relative cap on worklist iterations. (PR #80033)

Yitzhak Mandelbaum via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 30 08:53:36 PST 2024


https://github.com/ymand created https://github.com/llvm/llvm-project/pull/80033

As per the FIXME, this cap never really served its purpose. This patch
simplifies to a single, caller-specified, absolute cap.


>From fef909302d31b131007558252981270360fcac39 Mon Sep 17 00:00:00 2001
From: Yitzhak Mandelbaum <yitzhakm at google.com>
Date: Tue, 30 Jan 2024 16:52:13 +0000
Subject: [PATCH] [clang][dataflow] Drop block-relative cap on worklist
 iterations.

As per the FIXME, this cap never really served its purpose. This patch
simplifies to a single, caller-specified, absolute cap.
---
 .../Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp b/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
index 49e425bde66aa..4c88c46142d64 100644
--- a/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
+++ b/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
@@ -540,14 +540,6 @@ runTypeErasedDataflowAnalysis(
   Worklist.enqueueSuccessors(&Entry);
 
   AnalysisContext AC(CFCtx, Analysis, StartingEnv, BlockStates);
-
-  // FIXME: remove relative cap. There isn't really any good setting for
-  // `MaxAverageVisitsPerBlock`, so it has no clear value over using
-  // `MaxBlockVisits` directly.
-  static constexpr std::int32_t MaxAverageVisitsPerBlock = 4;
-  const std::int32_t RelativeMaxBlockVisits =
-      MaxAverageVisitsPerBlock * BlockStates.size();
-  MaxBlockVisits = std::min(RelativeMaxBlockVisits, MaxBlockVisits);
   std::int32_t BlockVisits = 0;
   while (const CFGBlock *Block = Worklist.dequeue()) {
     LLVM_DEBUG(llvm::dbgs()



More information about the cfe-commits mailing list