about summary refs log tree commit diff
diff options
context:
space:
mode:
authorScott McMurray <scottmcm@users.noreply.github.com>2023-05-07 03:00:41 -0700
committerScott McMurray <scottmcm@users.noreply.github.com>2023-05-31 19:10:28 -0700
commit3d0a0dccae89da3ef057dda6e84d480f7888eee9 (patch)
treed92bae983ed53ba50467e0030746eed736a8a08d
parentafe578791ad5325fe520d673cb666e7a6ac5487a (diff)
downloadrust-3d0a0dccae89da3ef057dda6e84d480f7888eee9.tar.gz
rust-3d0a0dccae89da3ef057dda6e84d480f7888eee9.zip
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.
-rw-r--r--src/builder.rs2
-rw-r--r--src/type_of.rs3
2 files changed, 2 insertions, 3 deletions
diff --git a/src/builder.rs b/src/builder.rs
index 869344ce92d..f9ea0f00456 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -758,7 +758,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
         assert_eq!(place.llextra.is_some(), place.layout.is_unsized());
 
         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) {
diff --git a/src/type_of.rs b/src/type_of.rs
index 5df8c1a209d..30a3fe67b85 100644
--- a/src/type_of.rs
+++ b/src/type_of.rs
@@ -159,8 +159,7 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
     fn is_gcc_immediate(&self) -> bool {
         match self.abi {
             Abi::Scalar(_) | Abi::Vector { .. } => true,
-            Abi::ScalarPair(..) => false,
-            Abi::Uninhabited | Abi::Aggregate { .. } => self.is_zst(),
+            Abi::ScalarPair(..) | Abi::Uninhabited | Abi::Aggregate { .. } => false,
         }
     }