Skip to content

Fix bad transformation in division simplification - #4930

Closed
meheff wants to merge 1 commit into
google:mainfrom
xlsynth:codex/fix-udiv-shift-overflow
Closed

meheff wants to merge 1 commit into
google:mainfrom
xlsynth:codex/fix-udiv-shift-overflow

Conversation

@meheff

@meheff meheff commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

The arithmetic simplification pass checks whether y << k can overflow before rewriting:

   x / (y << k)  →  (x / y) >> k

But it converted the unsigned maximum shift using signed ToInt64() which is incorrect as the semantics require interpretation of the value as an unsigned number.

@google-cla

google-cla Bot commented Sep 6, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@meheff meheff changed the title Fix unsigned shift bound in division simplification Fix bad transformation in division simplification Sep 6, 2026
@meheff

meheff commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator Author

Looks like the cla error is due to an codex push which added a local email address meheff@<somerandommachine.net>. Feel free to just clone this and submit the fix internally.

@ericastor

Copy link
Copy Markdown
Contributor

@meheff - we definitely shouldn't just clone & submit internally with a CLA violation flagged. Any chance you can get it fixed on your end?

@ericastor

Copy link
Copy Markdown
Contributor

I realized I have not looked at the actual content of this PR. As such, I'm taking this as a bug report instead & will fix it separately.

@ericastor ericastor closed this Sep 8, 2026
@meheff

meheff commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator Author

The CLA issue is that codex added meheff@mylocalmachinename.net as a coauthor. My own CLA is still up to date. I reopened this as a new PR #4949 without this problem.

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