-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Add a distinct OperandValue::ZeroSized
variant for ZSTs
#111318
Conversation
Some changes occurred in compiler/rustc_codegen_gcc cc @antoyo |
ebcd632
to
f315f57
Compare
@@ -220,31 +223,33 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { | |||
let fake_place = PlaceRef::new_sized_aligned(cast_ptr, cast, align); | |||
Some(bx.load_operand(fake_place).val) | |||
} | |||
OperandValue::ZeroSized => { | |||
let OperandValueKind::ZeroSized = operand_kind else { |
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.
Could this be an assert instead?
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.
It could. I wrote it this way for structural similarity with the other arms.
Maybe I should have made this be match (operand.val, operand_kind)
instead? Unsure.
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.
Itś not that big of a deal, both branches are pretty short
@@ -220,31 +223,33 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { | |||
let fake_place = PlaceRef::new_sized_aligned(cast_ptr, cast, align); | |||
Some(bx.load_operand(fake_place).val) | |||
} | |||
OperandValue::ZeroSized => { | |||
let OperandValueKind::ZeroSized = operand_kind else { |
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.
Itś not that big of a deal, both branches are pretty short
@bors r+ |
📌 Commit f315f57db8721e0993d9866c2cd5c3cae0fb6700 has been approved by It is now in the queue for this repository. |
⌛ Testing commit f315f57db8721e0993d9866c2cd5c3cae0fb6700 with merge 28d692dccbadccb687ae571daf3591510a451529... |
This comment has been minimized.
This comment has been minimized.
💔 Test failed - checks-actions |
Looks like a legit failure; I'll dig in. @bors r- |
b95bfa5
to
9495095
Compare
4e90953
to
9495095
Compare
Ah, so we do need to pass ZSTs in some ABIs. Fix: https://github.com/rust-lang/rust/compare/b95bfa5b2db64d5e985e8a6fa83358df3df345aa..9495095fe68b737254a20e39b3c744ca41e66d6f @bors r=compiler-errors |
…ompiler-errors Add a distinct `OperandValue::ZeroSized` variant for ZSTs These tend to have special handling in a bunch of places anyway, so the variant helps remember that. And I think it's easier to grok than `Aggregate`s sometimes being `Immediates` (after all, I previously got that wrong and caused rust-lang#109992). As a minor bonus, it means we don't need to generate poison LLVM values for ZSTs to pass around in `OperandValue::Immediate`s. Inspired by rust-lang#110021 (comment), so r? `@compiler-errors`
…ompiler-errors Add a distinct `OperandValue::ZeroSized` variant for ZSTs These tend to have special handling in a bunch of places anyway, so the variant helps remember that. And I think it's easier to grok than `Aggregate`s sometimes being `Immediates` (after all, I previously got that wrong and caused rust-lang#109992). As a minor bonus, it means we don't need to generate poison LLVM values for ZSTs to pass around in `OperandValue::Immediate`s. Inspired by rust-lang#110021 (comment), so r? ``@compiler-errors``
…ompiler-errors Add a distinct `OperandValue::ZeroSized` variant for ZSTs These tend to have special handling in a bunch of places anyway, so the variant helps remember that. And I think it's easier to grok than `Aggregate`s sometimes being `Immediates` (after all, I previously got that wrong and caused rust-lang#109992). As a minor bonus, it means we don't need to generate poison LLVM values for ZSTs to pass around in `OperandValue::Immediate`s. Inspired by rust-lang#110021 (comment), so r? ```@compiler-errors```
This comment has been minimized.
This comment has been minimized.
These tend to have special handling in a bunch of places anyway, so the variant helps remember that. And I think it's easier to grok than non-Scalar Aggregates sometimes being `Immediates` (like I got wrong and caused 109992). As a minor bonus, it means we don't need to generate poison LLVM values for them to pass around in `OperandValue::Immediate`s.
9495095
to
bf36193
Compare
Rollup of 7 pull requests Successful merges: - rust-lang#108459 (rustdoc: Fix LinkReplacer link matching) - rust-lang#111318 (Add a distinct `OperandValue::ZeroSized` variant for ZSTs) - rust-lang#111892 (rustdoc: add interaction delays for tooltip popovers) - rust-lang#111980 (Preserve substs in opaques recorded in typeck results) - rust-lang#112024 (Don't suggest break through nested items) - rust-lang#112128 (Don't compute inlining status of mono items in advance.) - rust-lang#112141 (remove reference to Into in ? operator core/std docs, fix rust-lang#111655) Failed merges: - rust-lang#112071 (Group rfcs tests) r? `@ghost` `@rustbot` modify labels: rollup
These tend to have special handling in a bunch of places anyway, so the variant helps remember that. And I think it's easier to grok than
Aggregate
s sometimes beingImmediates
(after all, I previously got that wrong and caused #109992). As a minor bonus, it means we don't need to generate poison LLVM values for ZSTs to pass around inOperandValue::Immediate
s.Inspired by #110021 (comment), so
r? @compiler-errors