Skip to content

Commit

Permalink
Revert rust-lang#26494 regression
Browse files Browse the repository at this point in the history
  • Loading branch information
shampoofactory committed Mar 3, 2022
1 parent f0c4da4 commit 9d45e0e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 45 deletions.
6 changes: 1 addition & 5 deletions compiler/rustc_middle/src/ty/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3226,12 +3226,8 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
_ => return,
}

// 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.
let max_by_val_size = Pointer.size(self) * 2;
let size = arg.layout.size;

if arg.layout.is_unsized() || size > max_by_val_size {
if arg.layout.is_unsized() || size > Pointer.size(self) {
arg.make_indirect();
} else {
// We want to pass small aggregates as immediates, but using
Expand Down
32 changes: 0 additions & 32 deletions src/test/codegen/arg-return-value-in-reg.rs

This file was deleted.

1 change: 1 addition & 0 deletions src/test/codegen/array-equality.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// compile-flags: -O
// only-x86_64
// ignore-test will need to be rewritten if pull accepted

#![crate_type = "lib"]

Expand Down
11 changes: 3 additions & 8 deletions src/test/codegen/union-abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,11 @@ pub union UnionU128{a:u128}
#[no_mangle]
pub fn test_UnionU128(_: UnionU128) -> UnionU128 { loop {} }

pub union UnionU128x2{a:(u128, u128)}
// CHECK: define void @test_UnionU128x2(i128 %_1.0, i128 %_1.1)
#[no_mangle]
pub fn test_UnionU128x2(_: UnionU128x2) { loop {} }

#[repr(C)]
pub union CUnionU128x2{a:(u128, u128)}
// CHECK: define void @test_CUnionU128x2(%CUnionU128x2* {{.*}} %_1)
pub union CUnionU128{a:u128}
// CHECK: define void @test_CUnionU128(%CUnionU128* {{.*}} %_1)
#[no_mangle]
pub fn test_CUnionU128x2(_: CUnionU128x2) { loop {} }
pub fn test_CUnionU128(_: CUnionU128) { loop {} }

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

0 comments on commit 9d45e0e

Please sign in to comment.