Skip to content

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

Merged
jvoung merged 6 commits into
llvm:mainfrom
jvoung:skip_visit_massive_cfg
Mar 18, 2026
Merged

[clang][FlowSensitive] Do a quick check and bail early for massive CFGs#186808
jvoung merged 6 commits into
llvm:mainfrom
jvoung:skip_visit_massive_cfg

Conversation

@jvoung

@jvoung jvoung commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

Bail out early if the visiting each reachable basic block once would have exceeded the MaxBlockVisits limit. If that is the case, then actually visiting and doing the dataflow analysis would hit the limit, but we would have wasted a lot of time.

Another possibility is that we run out of memory (OOM) and the process crashes. We've seen example of CFGs with # of blocks that are 2-8x the visit limit. Those examples also have lots of Locs, which we track in MapVectors for each BB. Since the maps do not share memory across BBs, this leads to non-linear memory usage and OOMing before hitting the max visit limit. With this, we can avoid OOMing, and at least get some results for the other CFGs in the TU, instead of losing all results from the process crashing.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:analysis clang:dataflow Clang Dataflow Analysis framework - https://clang.llvm.org/docs/DataFlowAnalysisIntro.html clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants