Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
De-LLVM the unchecked shifts [MCP#693] #123226
De-LLVM the unchecked shifts [MCP#693] #123226
Changes from all commits
0601f0c
327aa19
4626521
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason to make shift amount generic? Why not just
y: u32
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making the shift amount always u32 was actually what I did first.
However, MIR actually supports arbitrary heterogeneous shifts, even though for the unchecked once those weren't accessible. So when the RHS was always
u32
, that blew up a whole bunch of tests -- many wouldn't even compile, with-1
not being a validu32
.So supporting mixed types here is helpful in that we can still write tests that exercise those codepaths in CTFE and Codegen. And it doesn't make the lowering to MIR any harder, nor add any extra work to what the backends already needed to handle. It also turned out convenient in that the
align_offset
method actually ends up usingunchecked_shl<usize, usize>
with this this PR, though once you changecttz_nonzero
it'll also end up atunchecked_shl<usize, u32>
, I think.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit weird (given that we don't publicly expose this), but given this does not make backend more complex, ig this is fine.