]> git.proxmox.com Git - rustc.git/blob - debian/patches/0001-Revert-Auto-merge-of-79547.patch
Fix tests, fix s390x breakage
[rustc.git] / debian / patches / 0001-Revert-Auto-merge-of-79547.patch
1 From eaf7ea1fc339e1ff348ed941ed2e8c4d66f3e458 Mon Sep 17 00:00:00 2001
2 From: Josh Stone <jistone@redhat.com>
3 Date: Thu, 18 Feb 2021 19:14:58 -0800
4 Subject: [PATCH] Revert "Auto merge of #79547 - erikdesjardins:byval, r=nagisa"
5
6 This reverts commit a094ff9590b83c8f94d898f92c2964a5803ded06, reversing
7 changes made to d37afad0cc87bf709ad10c85319296ac53030f03.
8
9 See https://github.com/rust-lang/rust/issues/80810 for more background
10 ---
11 compiler/rustc_middle/src/ty/layout.rs | 12 ++++++------
12 ...return-value-in-reg.rs => return-value-in-reg.rs} | 4 ++--
13 src/test/codegen/union-abi.rs | 11 +++--------
14 3 files changed, 11 insertions(+), 16 deletions(-)
15 rename src/test/codegen/{arg-return-value-in-reg.rs => return-value-in-reg.rs} (74%)
16
17 diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs
18 index b545b92c9252..545f6aee1a21 100644
19 --- a/compiler/rustc_middle/src/ty/layout.rs
20 +++ b/compiler/rustc_middle/src/ty/layout.rs
21 @@ -2849,7 +2849,7 @@ fn adjust_for_abi(&mut self, cx: &C, abi: SpecAbi) {
22 || abi == SpecAbi::RustIntrinsic
23 || abi == SpecAbi::PlatformIntrinsic
24 {
25 - let fixup = |arg: &mut ArgAbi<'tcx, Ty<'tcx>>| {
26 + let fixup = |arg: &mut ArgAbi<'tcx, Ty<'tcx>>, is_ret: bool| {
27 if arg.is_ignore() {
28 return;
29 }
30 @@ -2887,9 +2887,9 @@ fn adjust_for_abi(&mut self, cx: &C, abi: SpecAbi) {
31 _ => return,
32 }
33
34 - // Pass and return structures up to 2 pointers in size by value, matching `ScalarPair`.
35 - // LLVM will usually pass these in 2 registers, which is more efficient than by-ref.
36 - let max_by_val_size = Pointer.size(cx) * 2;
37 + // Return structures up to 2 pointers in size by value, matching `ScalarPair`. LLVM
38 + // will usually return these in 2 registers, which is more efficient than by-ref.
39 + let max_by_val_size = if is_ret { Pointer.size(cx) * 2 } else { Pointer.size(cx) };
40 let size = arg.layout.size;
41
42 if arg.layout.is_unsized() || size > max_by_val_size {
43 @@ -2901,9 +2901,9 @@ fn adjust_for_abi(&mut self, cx: &C, abi: SpecAbi) {
44 arg.cast_to(Reg { kind: RegKind::Integer, size });
45 }
46 };
47 - fixup(&mut self.ret);
48 + fixup(&mut self.ret, true);
49 for arg in &mut self.args {
50 - fixup(arg);
51 + fixup(arg, false);
52 }
53 return;
54 }
55 diff --git a/src/test/codegen/arg-return-value-in-reg.rs b/src/test/codegen/return-value-in-reg.rs
56 similarity index 74%
57 rename from src/test/codegen/arg-return-value-in-reg.rs
58 rename to src/test/codegen/return-value-in-reg.rs
59 index a69291d47821..4bc0136c5e32 100644
60 --- a/src/test/codegen/arg-return-value-in-reg.rs
61 +++ b/src/test/codegen/return-value-in-reg.rs
62 @@ -1,4 +1,4 @@
63 -//! Check that types of up to 128 bits are passed and returned by-value instead of via pointer.
64 +//! This test checks that types of up to 128 bits are returned by-value instead of via out-pointer.
65
66 // compile-flags: -C no-prepopulate-passes -O
67 // only-x86_64
68 @@ -11,7 +11,7 @@ pub struct S {
69 c: u32,
70 }
71
72 -// CHECK: define i128 @modify(i128{{( %0)?}})
73 +// CHECK: define i128 @modify(%S* noalias nocapture dereferenceable(16) %s)
74 #[no_mangle]
75 pub fn modify(s: S) -> S {
76 S { a: s.a + s.a, b: s.b + s.b, c: s.c + s.c }
77 diff --git a/src/test/codegen/union-abi.rs b/src/test/codegen/union-abi.rs
78 index f282fd237054..afea01e9a2d0 100644
79 --- a/src/test/codegen/union-abi.rs
80 +++ b/src/test/codegen/union-abi.rs
81 @@ -63,16 +63,11 @@ pub union UnionU128{a:u128}
82 #[no_mangle]
83 pub fn test_UnionU128(_: UnionU128) -> UnionU128 { loop {} }
84
85 -pub union UnionU128x2{a:(u128, u128)}
86 -// CHECK: define void @test_UnionU128x2(i128 %_1.0, i128 %_1.1)
87 -#[no_mangle]
88 -pub fn test_UnionU128x2(_: UnionU128x2) { loop {} }
89 -
90 #[repr(C)]
91 -pub union CUnionU128x2{a:(u128, u128)}
92 -// CHECK: define void @test_CUnionU128x2(%CUnionU128x2* {{.*}} %_1)
93 +pub union CUnionU128{a:u128}
94 +// CHECK: define void @test_CUnionU128(%CUnionU128* {{.*}} %_1)
95 #[no_mangle]
96 -pub fn test_CUnionU128x2(_: CUnionU128x2) { loop {} }
97 +pub fn test_CUnionU128(_: CUnionU128) { loop {} }
98
99 pub union UnionBool { b:bool }
100 // CHECK: define zeroext i1 @test_UnionBool(i8 %b)
101 --
102 2.29.2
103