Skip to content

ConstraintAnalysis: Add inequality comparisons to constants#8924

Merged
kripken merged 8 commits into
WebAssembly:mainfrom
kripken:compar
Jul 23, 2026
Merged

ConstraintAnalysis: Add inequality comparisons to constants#8924
kripken merged 8 commits into
WebAssembly:mainfrom
kripken:compar

Conversation

@kripken

@kripken kripken commented Jul 21, 2026

Copy link
Copy Markdown
Member

When seeing if x == C proves x >= D, we can just apply C >= D.

And, in reverse, x >= D may imply x != C if C < D.

@kripken
kripken requested a review from tlively July 21, 2026 23:56
@kripken
kripken requested a review from a team as a code owner July 21, 2026 23:56
;; OPTIN-NEXT: (unreachable)
;; OPTIN-NEXT: )
;; OPTIN-NEXT: )
(func $flipped-contradiction (result i32)

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.

Can we also test the case with the (local.get $x) on the RHS? Or do we already have coverage for that?

@kripken kripken Jul 22, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, that is what OPTIN - running optimize-instructions first - tests. It canonicalizes the order of such things, and that canonical order is what matters.

@kripken
kripken merged commit a54b20b into WebAssembly:main Jul 23, 2026
16 checks passed
@kripken
kripken deleted the compar branch July 23, 2026 15:58
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