Skip to content

Commit 683e13f

Browse files
committed
Revert max_by_val_size * 2
1 parent c7e8880 commit 683e13f

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

compiler/rustc_middle/src/ty/layout.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -3362,11 +3362,9 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
33623362

33633363
match arg.layout.abi {
33643364
Abi::Aggregate { .. } => {
3365-
// Pass and return structures up to 2 pointers in size by value,
3366-
// matching `ScalarPair`. LLVM will usually pass these in 2 registers
3367-
// which is more efficient than by-ref.
3365+
// Pass and return structures up to 1 pointers in size by value.
33683366
let ptr_size = Pointer.size(self);
3369-
let max_by_val_size = ptr_size * 2;
3367+
let max_by_val_size = ptr_size;
33703368
let size = arg.layout.size;
33713369

33723370
if arg.layout.is_unsized() || size > max_by_val_size {

src/test/codegen/array-equality.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ pub fn array_eq_zero_short(x: [u16; 3]) -> bool {
5656
#[no_mangle]
5757
pub fn array_eq_zero_mid(x: [u16; 8]) -> bool {
5858
// CHECK-NEXT: start:
59-
// CHECK-NEXT: %[[EQ:.+]] = icmp eq i128 %0, 0
59+
// CHECK: %[[LOAD:.+]] = load i128,
60+
// CHECK-NEXT: %[[EQ:.+]] = icmp eq i128 %[[LOAD]], 0
6061
// CHECK-NEXT: ret i1 %[[EQ]]
6162
x == [0; 8]
6263
}

src/test/codegen/issue-37945.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub fn is_empty_1(xs: Iter<f32>) -> bool {
1717
// CHECK-NEXT: start:
1818
// CHECK-NEXT: [[A:%.*]] = icmp ne {{i32\*|ptr}} %xs.1, null
1919
// CHECK-NEXT: tail call void @llvm.assume(i1 [[A]])
20-
// CHECK-NEXT: [[B:%.*]] = icmp eq {{i32\*|ptr}} %xs.1, %xs.0
20+
// CHECK-NEXT: [[B:%.*]] = icmp eq {{i32\*|ptr}} {{%xs.1, %xs.0|%xs.0, %xs.1}}
2121
// CHECK-NEXT: ret i1 [[B:%.*]]
2222
{xs}.next().is_none()
2323
}
@@ -28,7 +28,7 @@ pub fn is_empty_2(xs: Iter<f32>) -> bool {
2828
// CHECK-NEXT: start:
2929
// CHECK-NEXT: [[C:%.*]] = icmp ne {{i32\*|ptr}} %xs.1, null
3030
// CHECK-NEXT: tail call void @llvm.assume(i1 [[C]])
31-
// CHECK-NEXT: [[D:%.*]] = icmp eq {{i32\*|ptr}} %xs.1, %xs.0
31+
// CHECK-NEXT: [[D:%.*]] = icmp eq {{i32\*|ptr}} {{%xs.1, %xs.0|%xs.0, %xs.1}}
3232
// CHECK-NEXT: ret i1 [[D:%.*]]
3333
xs.map(|&x| x).next().is_none()
3434
}

src/test/codegen/union-abi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub fn test_UnionU128(_: UnionU128) -> UnionU128 { loop {} }
6565

6666
#[repr(C)]
6767
pub union CUnionU128{a:u128}
68-
// CHECK: define void @test_CUnionU128(i128 %0)
68+
// CHECK: define void @test_CUnionU128({{%CUnionU128\*|ptr}} {{.*}} %_1)
6969
#[no_mangle]
7070
pub fn test_CUnionU128(_: CUnionU128) { loop {} }
7171

0 commit comments

Comments
 (0)