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 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.
This commit is contained in:
parent
afe578791a
commit
3d0a0dccae
@ -758,7 +758,7 @@ fn load_operand(&mut self, place: PlaceRef<'tcx, RValue<'gcc>>) -> OperandRef<'t
|
|||||||
assert_eq!(place.llextra.is_some(), place.layout.is_unsized());
|
assert_eq!(place.llextra.is_some(), place.layout.is_unsized());
|
||||||
|
|
||||||
if place.layout.is_zst() {
|
if place.layout.is_zst() {
|
||||||
return OperandRef::new_zst(self, place.layout);
|
return OperandRef::zero_sized(place.layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn scalar_load_metadata<'a, 'gcc, 'tcx>(bx: &mut Builder<'a, 'gcc, 'tcx>, load: RValue<'gcc>, scalar: &abi::Scalar) {
|
fn scalar_load_metadata<'a, 'gcc, 'tcx>(bx: &mut Builder<'a, 'gcc, 'tcx>, load: RValue<'gcc>, scalar: &abi::Scalar) {
|
||||||
|
@ -159,8 +159,7 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
|
|||||||
fn is_gcc_immediate(&self) -> bool {
|
fn is_gcc_immediate(&self) -> bool {
|
||||||
match self.abi {
|
match self.abi {
|
||||||
Abi::Scalar(_) | Abi::Vector { .. } => true,
|
Abi::Scalar(_) | Abi::Vector { .. } => true,
|
||||||
Abi::ScalarPair(..) => false,
|
Abi::ScalarPair(..) | Abi::Uninhabited | Abi::Aggregate { .. } => false,
|
||||||
Abi::Uninhabited | Abi::Aggregate { .. } => self.is_zst(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user