Skip to content

Commit

Permalink
Revert max_by_val_size * 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Urgau committed Jul 5, 2022
1 parent c7e8880 commit 683e13f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
6 changes: 2 additions & 4 deletions compiler/rustc_middle/src/ty/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3362,11 +3362,9 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {

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

if arg.layout.is_unsized() || size > max_by_val_size {
Expand Down
3 changes: 2 additions & 1 deletion src/test/codegen/array-equality.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ pub fn array_eq_zero_short(x: [u16; 3]) -> bool {
#[no_mangle]
pub fn array_eq_zero_mid(x: [u16; 8]) -> bool {
// CHECK-NEXT: start:
// CHECK-NEXT: %[[EQ:.+]] = icmp eq i128 %0, 0
// CHECK: %[[LOAD:.+]] = load i128,
// CHECK-NEXT: %[[EQ:.+]] = icmp eq i128 %[[LOAD]], 0
// CHECK-NEXT: ret i1 %[[EQ]]
x == [0; 8]
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/codegen/issue-37945.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub fn is_empty_1(xs: Iter<f32>) -> bool {
// CHECK-NEXT: start:
// CHECK-NEXT: [[A:%.*]] = icmp ne {{i32\*|ptr}} %xs.1, null
// CHECK-NEXT: tail call void @llvm.assume(i1 [[A]])
// CHECK-NEXT: [[B:%.*]] = icmp eq {{i32\*|ptr}} %xs.1, %xs.0
// CHECK-NEXT: [[B:%.*]] = icmp eq {{i32\*|ptr}} {{%xs.1, %xs.0|%xs.0, %xs.1}}
// CHECK-NEXT: ret i1 [[B:%.*]]
{xs}.next().is_none()
}
Expand All @@ -28,7 +28,7 @@ pub fn is_empty_2(xs: Iter<f32>) -> bool {
// CHECK-NEXT: start:
// CHECK-NEXT: [[C:%.*]] = icmp ne {{i32\*|ptr}} %xs.1, null
// CHECK-NEXT: tail call void @llvm.assume(i1 [[C]])
// CHECK-NEXT: [[D:%.*]] = icmp eq {{i32\*|ptr}} %xs.1, %xs.0
// CHECK-NEXT: [[D:%.*]] = icmp eq {{i32\*|ptr}} {{%xs.1, %xs.0|%xs.0, %xs.1}}
// CHECK-NEXT: ret i1 [[D:%.*]]
xs.map(|&x| x).next().is_none()
}
2 changes: 1 addition & 1 deletion src/test/codegen/union-abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub fn test_UnionU128(_: UnionU128) -> UnionU128 { loop {} }

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

Expand Down

0 comments on commit 683e13f

Please sign in to comment.