summaryrefslogtreecommitdiffstats
path: root/tests/codegen/zst-offset.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/codegen/zst-offset.rs (renamed from src/test/codegen/zst-offset.rs)11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/test/codegen/zst-offset.rs b/tests/codegen/zst-offset.rs
index 29d2a1754..cef4b9bda 100644
--- a/src/test/codegen/zst-offset.rs
+++ b/tests/codegen/zst-offset.rs
@@ -1,4 +1,4 @@
-// compile-flags: -C no-prepopulate-passes
+// compile-flags: -C no-prepopulate-passes -Copt-level=0
#![crate_type = "lib"]
#![feature(repr_simd)]
@@ -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) {}