Skip to content

Bypass zext when comparing against a constant. - #2299

Open
ltratt wants to merge 1 commit into
ykjit:masterfrom
ltratt:bypass_zext
Open

ltratt wants to merge 1 commit into
ykjit:masterfrom
ltratt:bypass_zext

Conversation

@ltratt

@ltratt ltratt commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

When we're comparing a zero-extended variable against a constant integer, we can bypass the zext if the constant fits into the narrower width. This isn't always a win (sometimes we want the zext value for other purposes), but it wins more often than it loses.

Several existing tests have to be changed because they are now more fully optimised.

@ltratt
ltratt enabled auto-merge September 16, 2026 12:39
@ltratt
ltratt added this pull request to the merge queue Sep 16, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 16, 2026
When we're comparing a zero-extended variable against a constant
integer, we can bypass the `zext` if the constant fits into the narrower
width. This isn't always a win (sometimes we want the `zext` value for
other purposes), but it wins more often than it loses.

Several existing tests have to be changed because they are now more
fully optimised.
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