Skip to content

ConstraintAnalysis: Add more simple inequalities - #8955

Merged
kripken merged 4 commits into
WebAssembly:mainfrom
kripken:cineq.moar
Jul 31, 2026
Merged

ConstraintAnalysis: Add more simple inequalities#8955
kripken merged 4 commits into
WebAssembly:mainfrom
kripken:cineq.moar

Conversation

@kripken

@kripken kripken commented Jul 30, 2026

Copy link
Copy Markdown
Member

These are the last pieces needed before the next PR, which will handle
loop overflows.

@kripken
kripken requested a review from tlively July 30, 2026 19:43
@kripken
kripken requested a review from a team as a code owner July 30, 2026 19:43
Comment thread src/ir/constraint.cpp
Comment on lines +314 to +315
if (ac->type == bc->type && ac->type.isInteger() &&
ac->add(Literal::makeFromInt32(1, ac->type)) == *bc) {

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.

We need to handle overflow here, right? IIRC, we don't consider x > UINT_MAX a contradiction, so we can end up with x > UINT_MAX || x >= 0. Then we would incorrectly turn this into x > UINT_MAX and misoptimize subsequent code.

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.

Good catch, I pulled this out of the next PR, which guards against overflow elsewhere, which made this invalid.

Fixed.

@kripken
kripken merged commit 9c10867 into WebAssembly:main Jul 31, 2026
16 checks passed
@kripken
kripken deleted the cineq.moar branch July 31, 2026 18:01
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