--- /dev/null
+From eaf7ea1fc339e1ff348ed941ed2e8c4d66f3e458 Mon Sep 17 00:00:00 2001
+From: Josh Stone <jistone@redhat.com>
+Date: Thu, 18 Feb 2021 19:14:58 -0800
+Subject: [PATCH] Revert "Auto merge of #79547 - erikdesjardins:byval, r=nagisa"
+
+This reverts commit a094ff9590b83c8f94d898f92c2964a5803ded06, reversing
+changes made to d37afad0cc87bf709ad10c85319296ac53030f03.
+
+See https://github.com/rust-lang/rust/issues/80810 for more background
+---
+ compiler/rustc_middle/src/ty/layout.rs | 12 ++++++------
+ ...return-value-in-reg.rs => return-value-in-reg.rs} | 4 ++--
+ src/test/codegen/union-abi.rs | 11 +++--------
+ 3 files changed, 11 insertions(+), 16 deletions(-)
+ rename src/test/codegen/{arg-return-value-in-reg.rs => return-value-in-reg.rs} (74%)
+
+diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs
+index b545b92c9252..545f6aee1a21 100644
+--- a/compiler/rustc_middle/src/ty/layout.rs
++++ b/compiler/rustc_middle/src/ty/layout.rs
+@@ -2849,7 +2849,7 @@ fn adjust_for_abi(&mut self, cx: &C, abi: SpecAbi) {
+ || abi == SpecAbi::RustIntrinsic
+ || abi == SpecAbi::PlatformIntrinsic
+ {
+- let fixup = |arg: &mut ArgAbi<'tcx, Ty<'tcx>>| {
++ let fixup = |arg: &mut ArgAbi<'tcx, Ty<'tcx>>, is_ret: bool| {
+ if arg.is_ignore() {
+ return;
+ }
+@@ -2887,9 +2887,9 @@ fn adjust_for_abi(&mut self, cx: &C, abi: SpecAbi) {
+ _ => 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(cx) * 2;
++ // Return structures up to 2 pointers in size by value, matching `ScalarPair`. LLVM
++ // will usually return these in 2 registers, which is more efficient than by-ref.
++ let max_by_val_size = if is_ret { Pointer.size(cx) * 2 } else { Pointer.size(cx) };
+ let size = arg.layout.size;
+
+ if arg.layout.is_unsized() || size > max_by_val_size {
+@@ -2901,9 +2901,9 @@ fn adjust_for_abi(&mut self, cx: &C, abi: SpecAbi) {
+ arg.cast_to(Reg { kind: RegKind::Integer, size });
+ }
+ };
+- fixup(&mut self.ret);
++ fixup(&mut self.ret, true);
+ for arg in &mut self.args {
+- fixup(arg);
++ fixup(arg, false);
+ }
+ return;
+ }
+diff --git a/src/test/codegen/arg-return-value-in-reg.rs b/src/test/codegen/return-value-in-reg.rs
+similarity index 74%
+rename from src/test/codegen/arg-return-value-in-reg.rs
+rename to src/test/codegen/return-value-in-reg.rs
+index a69291d47821..4bc0136c5e32 100644
+--- a/src/test/codegen/arg-return-value-in-reg.rs
++++ b/src/test/codegen/return-value-in-reg.rs
+@@ -1,4 +1,4 @@
+-//! Check that types of up to 128 bits are passed and returned by-value instead of via pointer.
++//! This test checks that types of up to 128 bits are returned by-value instead of via out-pointer.
+
+ // compile-flags: -C no-prepopulate-passes -O
+ // only-x86_64
+@@ -11,7 +11,7 @@ pub struct S {
+ c: u32,
+ }
+
+-// CHECK: define i128 @modify(i128{{( %0)?}})
++// CHECK: define i128 @modify(%S* noalias nocapture dereferenceable(16) %s)
+ #[no_mangle]
+ pub fn modify(s: S) -> S {
+ S { a: s.a + s.a, b: s.b + s.b, c: s.c + s.c }
+diff --git a/src/test/codegen/union-abi.rs b/src/test/codegen/union-abi.rs
+index f282fd237054..afea01e9a2d0 100644
+--- a/src/test/codegen/union-abi.rs
++++ b/src/test/codegen/union-abi.rs
+@@ -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 zeroext i1 @test_UnionBool(i8 %b)
+--
+2.29.2
+
--- /dev/null
+From 9756838f612da2ef6c359aaea8bf0a69ad76716a Mon Sep 17 00:00:00 2001
+From: Josh Stone <jistone@redhat.com>
+Date: Mon, 11 Jan 2021 15:13:26 -0800
+Subject: [PATCH] differentiate functions in extern-compare-with-return-type.rs
+
+---
+ src/test/ui/extern/extern-compare-with-return-type.rs | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/src/test/ui/extern/extern-compare-with-return-type.rs b/src/test/ui/extern/extern-compare-with-return-type.rs
+index 6c9ed3760f6e4..52b51bb943aa6 100644
+--- a/src/test/ui/extern/extern-compare-with-return-type.rs
++++ b/src/test/ui/extern/extern-compare-with-return-type.rs
+@@ -2,8 +2,9 @@
+ // Tests that we can compare various kinds of extern fn signatures.
+ #![allow(non_camel_case_types)]
+
+-extern fn voidret1() {}
+-extern fn voidret2() {}
++// `dbg!()` differentiates these functions to ensure they won't be merged.
++extern fn voidret1() { dbg!() }
++extern fn voidret2() { dbg!() }
+
+ extern fn uintret() -> usize { 22 }
+
--- /dev/null
+Bug: https://github.com/rust-lang/rust/issues/84038
+--- a/src/test/ui/asm/naked-invalid-attr.rs
++++ b/src/test/ui/asm/naked-invalid-attr.rs
+@@ -1,6 +1,10 @@
+ // Checks that #[naked] attribute can be placed on function definitions only.
+ //
+ // ignore-wasm32 asm unsupported
++// ignore-powerpc64 asm unsupported
++// ignore-powerpc64le asm unsupported
++// ignore-s390x asm unsupported
++// ignore-sparc64 asm unsupported
+ #![feature(asm)]
+ #![feature(naked_functions)]
+ #![naked] //~ ERROR should be applied to a function definition
+--- a/src/test/ui/feature-gates/feature-gate-naked_functions.rs
++++ b/src/test/ui/feature-gates/feature-gate-naked_functions.rs
+@@ -1,3 +1,7 @@
++// ignore-powerpc64 asm unsupported
++// ignore-powerpc64le asm unsupported
++// ignore-s390x asm unsupported
++// ignore-sparc64 asm unsupported
+ #![feature(asm)]
+
+ #[naked]
+--- a/src/test/ui/rfc-2091-track-caller/error-with-naked.rs
++++ b/src/test/ui/rfc-2091-track-caller/error-with-naked.rs
+@@ -1,3 +1,7 @@
++// ignore-powerpc64 asm unsupported
++// ignore-powerpc64le asm unsupported
++// ignore-s390x asm unsupported
++// ignore-sparc64 asm unsupported
+ #![feature(asm, naked_functions)]
+
+ #[track_caller] //~ ERROR cannot use `#[track_caller]` with `#[naked]`