Skip to content

[NFC] ConstraintAnalysis: Track relevant locals#8921

Open
kripken wants to merge 20 commits into
WebAssembly:mainfrom
kripken:constraint.relevant
Open

[NFC] ConstraintAnalysis: Track relevant locals#8921
kripken wants to merge 20 commits into
WebAssembly:mainfrom
kripken:constraint.relevant

Conversation

@kripken

@kripken kripken commented Jul 20, 2026

Copy link
Copy Markdown
Member

By avoiding work on irrelevant locals - ones we can't prove anything for -
we make the pass 20% faster.

@kripken
kripken requested a review from a team as a code owner July 20, 2026 21:24
@kripken
kripken requested review from tlively and removed request for a team July 20, 2026 21:24
// to is relevant as well. We store pairs here of key=source, value=targets.
std::unordered_map<Index, std::vector<Index>> localCopyTargets;

void markRelevant(Expression* curr) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
void markRelevant(Expression* curr) {
void maybeMarkRelevant(Expression* curr) {

Since this does not unconditionally mark the expression relevant.

Comment on lines +90 to +92
// Track local copies too, as if one local is relevant, another it is copied
// to is relevant as well. We store pairs here of key=source, value=targets.
std::unordered_map<Index, std::vector<Index>> localCopyTargets;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't we be propagating relevance backward from copy destination to copy source? If I have a local $x whose value is never set or compared to anything, then it is copied to relevant $y, then I want to have that initial $x = 0 constraint. In contrast, if I have relevant $y and it is copied to irrelevant $z, then there is no need to consider $z relevant.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants