Skip to content

Commit 88e4d2c

Browse files
committed
rustc_trans: work around i686-pc-windows-msvc byval align LLVM bug.
1 parent b0812de commit 88e4d2c

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/librustc_trans/abi.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,9 @@ impl<'a, 'tcx> ArgType<'tcx> {
491491
.set(ArgAttribute::NoCapture)
492492
.set(ArgAttribute::NonNull);
493493
attrs.pointee_size = self.layout.size;
494-
attrs.pointee_align = Some(self.layout.align);
494+
// FIXME(eddyb) We should be doing this, but at least on
495+
// i686-pc-windows-msvc, it results in wrong stack offsets.
496+
// attrs.pointee_align = Some(self.layout.align);
495497

496498
self.mode = PassMode::Indirect(attrs);
497499
}

src/test/codegen/function-arguments.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pub fn mutable_unsafe_borrow(_: &mut UnsafeInner) {
6666
pub fn mutable_borrow(_: &mut i32) {
6767
}
6868

69-
// CHECK: @indirect_struct(%S* noalias nocapture align 4 dereferenceable(32) %arg0)
69+
// CHECK: @indirect_struct(%S* noalias nocapture dereferenceable(32) %arg0)
7070
#[no_mangle]
7171
pub fn indirect_struct(_: S) {
7272
}
@@ -83,7 +83,7 @@ pub fn _box(x: Box<i32>) -> Box<i32> {
8383
x
8484
}
8585

86-
// CHECK: @struct_return(%S* noalias nocapture sret align 4 dereferenceable(32))
86+
// CHECK: @struct_return(%S* noalias nocapture sret dereferenceable(32))
8787
#[no_mangle]
8888
pub fn struct_return() -> S {
8989
S {

src/test/codegen/packed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub struct BigPacked {
3939
#[no_mangle]
4040
pub fn call_pkd(f: fn() -> Array) -> BigPacked {
4141
// CHECK: [[ALLOCA:%[_a-z0-9]+]] = alloca %Array
42-
// CHECK: call void %{{.*}}(%Array* noalias nocapture sret align 4 dereferenceable(32) [[ALLOCA]])
42+
// CHECK: call void %{{.*}}(%Array* noalias nocapture sret dereferenceable(32) [[ALLOCA]])
4343
// CHECK: call void @llvm.memcpy.{{.*}}(i8* %{{.*}}, i8* %{{.*}}, i{{[0-9]+}} 32, i32 1, i1 false)
4444
// check that calls whose destination is a field of a packed struct
4545
// go through an alloca rather than calling the function with an

0 commit comments

Comments
 (0)