Skip to content

ConstraintAnalysis: Optimize loops - #8980

Open
kripken wants to merge 132 commits into
WebAssembly:mainfrom
kripken:loops
Open

ConstraintAnalysis: Optimize loops#8980
kripken wants to merge 132 commits into
WebAssembly:mainfrom
kripken:loops

Conversation

@kripken

@kripken kripken commented Aug 7, 2026

Copy link
Copy Markdown
Member

One Weird Trick is enough: eagerly extend ranges of constants:

x = C
branch on x < D where C < D
=>
x >= C && x < D

This is simpler than the typical approach used in Abstract Interpretation,
as we do it eagerly (immediately on a branch). This eagerness might
lose some precision, but not in cases we care about, I don't think:
if x is a constant and we branch on it, then it must be a loop variable
that will increment (if it isn't in a loop, the constant x would have been
propagated to the branch by other passes).

@kripken
kripken requested a review from tlively August 7, 2026 18:47
@kripken
kripken requested a review from a team as a code owner August 7, 2026 18:47
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.

1 participant