about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-01-07 16:13:18 +0000
committerbors <bors@rust-lang.org>2023-01-07 16:13:18 +0000
commitb1691f6413a4afd7529ab309965123cc63e82021 (patch)
tree2f35c6736a61332a704244fdf3465a8c10874cc3 /src/test/codegen
parenta2112fcb0ad7327b9f1ee618c18567d74fc084b1 (diff)
parenta48127f0dc019e75b2e3c96d6c37b4c022f6edc6 (diff)
Auto merge of #105323 - cjgillot:simplify-const-prop, r=davidtwco
Perform SimplifyLocals before ConstProp.

MIR before `ConstProp` may have a lot of dead writes, this makes `ConstProp` do unnecessary work.

r? `@ghost`
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/zst-offset.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/test/codegen/zst-offset.rs b/src/test/codegen/zst-offset.rs
index 29d2a1754a3..844d5870a84 100644
--- a/src/test/codegen/zst-offset.rs
+++ b/src/test/codegen/zst-offset.rs
@@ -15,7 +15,7 @@ pub fn helper(_: usize) {
 pub fn scalar_layout(s: &(u64, ())) {
 // CHECK: getelementptr i8, {{.+}}, [[USIZE]] 8
     let x = &s.1;
-    &x; // keep variable in an alloca
+    witness(&x); // keep variable in an alloca
 }
 
 // Check that we correctly generate a GEP for a ZST that is not included in ScalarPair layout
@@ -24,7 +24,7 @@ pub fn scalar_layout(s: &(u64, ())) {
 pub fn scalarpair_layout(s: &(u64, u32, ())) {
 // CHECK: getelementptr i8, {{.+}}, [[USIZE]] 12
     let x = &s.2;
-    &x; // keep variable in an alloca
+    witness(&x); // keep variable in an alloca
 }
 
 #[repr(simd)]
@@ -36,5 +36,8 @@ pub struct U64x4(u64, u64, u64, u64);
 pub fn vector_layout(s: &(U64x4, ())) {
 // CHECK: getelementptr i8, {{.+}}, [[USIZE]] 32
     let x = &s.1;
-    &x; // keep variable in an alloca
+    witness(&x); // keep variable in an alloca
 }
+
+#[inline(never)]
+fn witness(_: &impl Sized) {}