llvm / llvm/llvm-project

Add tiering or configuration of Solvers for Clang Dataflow Framework

Open
#204,593 2 comments 0 reactions 0 assignees View on GitHub
clang:dataflow
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Currently, the CDF checkers default to WatchedLiteralsSolver, which is okay for simple problems but doesn't scale well to more complex problems (see reports like issue #69369).

Internally, we've been using tiers of solvers (a) start with WatchedLiteralsSolver for only a few iterations, and then (b) switch to a production-grade solver after that, and that has worked better. For (b), we could for example use Z3 w/ some limits set as well.

The default should be improved in the [diagnoseFunction](https://github.com/llvm/llvm-project/blob/3c33c36d925f5d278501fea55ef5a2e1f8f331ca/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h#L322) entry point, but we should also be able to take a custom solver (e.g., it is currently configurable though, e.g., [DataflowAnalysisContext](https://github.com/llvm/llvm-project/blob/3c33c36d925f5d278501fea55ef5a2e1f8f331ca/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h#L91) if you instead use the [runDataflowAnalysis](https://github.com/llvm/llvm-project/blob/3c33c36d925f5d278501fea55ef5a2e1f8f331ca/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h#L234) entry point)

Contributor guide

Open the contributing guide

Research direction

Start by reading clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h, especially the diagnoseFunction and runDataflowAnalysis entry points, then inspect DataflowAnalysisContext.h. Compare the current WatchedLiteralsSolver default with the requested tiered or configurable approach, including the possible Z3 option and limits. Done means the default scales better while callers can still provide a custom solver.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.