about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-11-29 02:56:24 +0000
committerbors <bors@rust-lang.org>2018-11-29 02:56:24 +0000
commita49316ddc99d9d595193557fc899f6c52e4d9af9 (patch)
tree50d4aea66b3ada194fe369fd96467d51b4619cba /src/test/codegen
parent5f387a6032ee7c5e575e06c596328ff556a1675d (diff)
parent51cf4e9e91ffcb1ab08bbcfa84841efb38c315e4 (diff)
downloadrust-a49316ddc99d9d595193557fc899f6c52e4d9af9.tar.gz
rust-a49316ddc99d9d595193557fc899f6c52e4d9af9.zip
Auto merge of #56329 - eddyb:load-operand-overaligned, r=nikomatsakis
rustc_codegen_llvm: don't overalign loads of pair operands.

Counterpart to #56300, but for loads instead of stores.
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/issue-56267-2.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/codegen/issue-56267-2.rs b/src/test/codegen/issue-56267-2.rs
new file mode 100644
index 00000000000..53b83f4a530
--- /dev/null
+++ b/src/test/codegen/issue-56267-2.rs
@@ -0,0 +1,18 @@
+// compile-flags: -C no-prepopulate-passes
+
+#![crate_type="rlib"]
+
+#[allow(dead_code)]
+pub struct Foo<T> {
+    foo: u64,
+    bar: T,
+}
+
+// The load from bar.1 should have alignment 4. Not checking
+// other loads here, as the alignment will be platform-dependent.
+
+// CHECK: %{{.+}} = load i32, i32* %{{.+}}, align 4
+#[no_mangle]
+pub fn test(x: Foo<(i32, i32)>) -> (i32, i32) {
+    x.bar
+}