Skip to content

Commit 9d45e0e

Browse files
Revert #26494 regression
1 parent f0c4da4 commit 9d45e0e

File tree

4 files changed

+5
-45
lines changed

4 files changed

+5
-45
lines changed

compiler/rustc_middle/src/ty/layout.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -3226,12 +3226,8 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
32263226
_ => return,
32273227
}
32283228

3229-
// Pass and return structures up to 2 pointers in size by value, matching `ScalarPair`.
3230-
// LLVM will usually pass these in 2 registers, which is more efficient than by-ref.
3231-
let max_by_val_size = Pointer.size(self) * 2;
32323229
let size = arg.layout.size;
3233-
3234-
if arg.layout.is_unsized() || size > max_by_val_size {
3230+
if arg.layout.is_unsized() || size > Pointer.size(self) {
32353231
arg.make_indirect();
32363232
} else {
32373233
// We want to pass small aggregates as immediates, but using

src/test/codegen/arg-return-value-in-reg.rs

-32
This file was deleted.

src/test/codegen/array-equality.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// compile-flags: -O
22
// only-x86_64
3+
// ignore-test will need to be rewritten if pull accepted
34

45
#![crate_type = "lib"]
56

src/test/codegen/union-abi.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,11 @@ pub union UnionU128{a:u128}
6363
#[no_mangle]
6464
pub fn test_UnionU128(_: UnionU128) -> UnionU128 { loop {} }
6565

66-
pub union UnionU128x2{a:(u128, u128)}
67-
// CHECK: define void @test_UnionU128x2(i128 %_1.0, i128 %_1.1)
68-
#[no_mangle]
69-
pub fn test_UnionU128x2(_: UnionU128x2) { loop {} }
70-
7166
#[repr(C)]
72-
pub union CUnionU128x2{a:(u128, u128)}
73-
// CHECK: define void @test_CUnionU128x2(%CUnionU128x2* {{.*}} %_1)
67+
pub union CUnionU128{a:u128}
68+
// CHECK: define void @test_CUnionU128(%CUnionU128* {{.*}} %_1)
7469
#[no_mangle]
75-
pub fn test_CUnionU128x2(_: CUnionU128x2) { loop {} }
70+
pub fn test_CUnionU128(_: CUnionU128) { loop {} }
7671

7772
pub union UnionBool { b:bool }
7873
// CHECK: define noundef zeroext i1 @test_UnionBool(i8 %b)

0 commit comments

Comments
 (0)