diff --git a/0001-Revert-Ignore-the-always-part-of-inline-always-in-MI.patch b/0001-Revert-Ignore-the-always-part-of-inline-always-in-MI.patch new file mode 100644 index 0000000..cefda23 --- /dev/null +++ b/0001-Revert-Ignore-the-always-part-of-inline-always-in-MI.patch @@ -0,0 +1,41 @@ +From 816745286555b978e8b0fe05d3bc99d28218587b Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Thu, 31 Aug 2023 13:37:23 -0700 +Subject: [PATCH] Revert "Ignore the always part of #[inline(always)] in MIR + inlining" + +This reverts part of commit c153f3a356b0e7917c91d3a804b93fadffb778b0. + +On Fedora 37 with LLVM 15, we were seeing strange errors from the stage2 +rustc on ppc64le, which seemed to imply bad codegen in rustc itself. Git +bisect pointed to this MIR inlining change -- it's not likely the root +cause, since later Fedora with LLVM 16 is working, but this will unblock +us for now. +--- + compiler/rustc_mir_transform/src/inline.rs | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs +index fc9e18378d5a..800155922b28 100644 +--- a/compiler/rustc_mir_transform/src/inline.rs ++++ b/compiler/rustc_mir_transform/src/inline.rs +@@ -499,12 +499,11 @@ fn check_mir_body( + } + } + +- // N.B. We still apply our cost threshold to #[inline(always)] functions. +- // That attribute is often applied to very large functions that exceed LLVM's (very +- // generous) inlining threshold. Such functions are very poor MIR inlining candidates. +- // Always inlining #[inline(always)] functions in MIR, on net, slows down the compiler. + let cost = checker.cost; +- if cost <= threshold { ++ if let InlineAttr::Always = callee_attrs.inline { ++ debug!("INLINING {:?} because inline(always) [cost={}]", callsite, cost); ++ Ok(()) ++ } else if cost <= threshold { + debug!("INLINING {:?} [cost={} <= threshold={}]", callsite, cost, threshold); + Ok(()) + } else { +-- +2.41.0 + diff --git a/rust.spec b/rust.spec index 6b51a37..c2b3c03 100644 --- a/rust.spec +++ b/rust.spec @@ -118,6 +118,9 @@ Patch3: 0001-Let-environment-variables-override-some-default-CPUs.patch Patch4: 0001-bootstrap-allow-disabling-target-self-contained.patch Patch5: 0002-set-an-external-library-path-for-wasm32-wasi.patch +# Revert a MIR inlining change that broke ppc64le with LLVM 15. +Patch6: 0001-Revert-Ignore-the-always-part-of-inline-always-in-MI.patch + ### RHEL-specific patches below ### # Simple rpm macros for rust-toolset (as opposed to full rust-packaging) @@ -558,6 +561,7 @@ rm -rf %{wasi_libc_dir}/dlmalloc/ %if %without bundled_wasi_libc %patch -P5 -p1 %endif +%patch -P6 -p1 %if %with disabled_libssh2 %patch -P100 -p1