Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor ConstantInterval #8179

Merged
merged 22 commits into from
Apr 25, 2024
Merged

Refactor ConstantInterval #8179

merged 22 commits into from
Apr 25, 2024

Conversation

abadams
Copy link
Member

@abadams abadams commented Apr 4, 2024

This is the bulk of #8155, pulled out for separate review.

This PR pulls the ConstantInterval class out of Interval.h, and the arithmetic helpers for it out of Monotonic.cpp. It then refactors Monotonic.cpp to use it, including using a new bounds inference routine to use instead of find_constant_bounds. It adds fuzz tests for both the new bounds inference routine and the interval arithmetic itself.

The fuzz test shows a lot of errors due to the lossless_cast casting bugs revealed in #8155, so those are simply reported for now, though I did fix the most egregious bug in lossless_cast to reduce the noise. The fuzz test also found another error to fix in FindIntrinsics.cpp

After this, the next step is to refactor the simplifier to use this ConstantInterval instead of rolling its own thing, and then actually fixing the lossless_cast bug, which has trickle-on effects in instruction selection.

@abadams
Copy link
Member Author

abadams commented Apr 5, 2024

@rootjalex I think you would be ideal to review this (Not urgently - once you're out from under your current crunch)

@rootjalex
Copy link
Member

Will take a look next week!

src/ConstantBounds.cpp Outdated Show resolved Hide resolved
src/ConstantInterval.cpp Outdated Show resolved Hide resolved
src/ConstantInterval.cpp Outdated Show resolved Hide resolved
src/ConstantInterval.cpp Outdated Show resolved Hide resolved
Copy link
Member

@rootjalex rootjalex left a comment

Choose a reason for hiding this comment

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

Lgtm with nits

@abadams
Copy link
Member Author

abadams commented Apr 22, 2024

I believe I have addressed review comments, PTAAL (mostly for operator<<)

src/ConstantInterval.cpp Outdated Show resolved Hide resolved
@abadams
Copy link
Member Author

abadams commented Apr 24, 2024

Well now there's a fuzz test failure, so something's probably not right with the new operator<<. Will investigate.

@abadams
Copy link
Member Author

abadams commented Apr 24, 2024

The fuzzer failure was just lossless_negate being wrong, which is to be fixed in #8155

@abadams abadams merged commit 302aa1c into main Apr 25, 2024
19 checks passed
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