Skip to content

Data flow: Earlier pruning based on accessPathLimit - #22320

Open
hvitved wants to merge 1 commit into
github:mainfrom
hvitved:dataflow/ap-limit-check
Open

Data flow: Earlier pruning based on accessPathLimit#22320
hvitved wants to merge 1 commit into
github:mainfrom
hvitved:dataflow/ap-limit-check

Conversation

@hvitved

@hvitved hvitved commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

accessPathLimit = 0 is checked in stage 1 and accessPathLimit = 1 is checked in stage 2, however all other access path limits are not checked until stage 5.

While we cannot in general know the lengths of access paths in stages 4 and below, we can provide lower bounds, and then check those bounds against accessPathLimit. This generalizes the check from stage 2, but unlike that check, it requires non-linear recursion, so I decided to keep the original check as-is and only apply the new check when accessPathLimit() > 1.

DCA shows a massive 60 % reduction in total analysis time for microsoft__vscode (down 966 s from 2,510 s).

Comment thread shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll Fixed
@hvitved
hvitved force-pushed the dataflow/ap-limit-check branch from e0656b4 to fec02fb Compare August 11, 2026 12:27
@hvitved hvitved added the no-change-note-required This PR does not need a change note label Aug 12, 2026
@hvitved
hvitved marked this pull request as ready for review August 12, 2026 06:53
@hvitved
hvitved requested a review from a team as a code owner August 12, 2026 06:53
Copilot AI balanced review requested due to automatic review settings August 12, 2026 06:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds earlier access-path pruning to improve data-flow analysis performance.

Changes:

  • Computes lower bounds for forward and reverse access-path lengths.
  • Prunes paths exceeding accessPathLimit before stage 5.
Show a summary per file
File Description
shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll Adds earlier forward and reverse access-path pruning.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Suppressed comments (1)

shared/dataflow/codeql/dataflow/internal/DataFlowImpl.qll:1343

  • Use the plural “stages” because this refers to both stage 1 and stage 2.
          accessPathLimit() > 1 and // `accessPathLimit() <= 1` is already checked in stage 1 and 2
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Balanced


pragma[nomagic]
private int getAPossibleMinimumLength(Ap ap) {
accessPathLimit() > 1 and // `accessPathLimit() <= 1` is already checked in stage 1 and 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DataFlow Library no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants