AlmaLinux change: Use x86_64-redhat-linux as default gcc triple for x86_64_v2

Add riscv64 support
This commit is contained in:
Eduard Abdullin 2026-04-13 07:26:03 +00:00 committed by root
commit 3dd48149c8
6 changed files with 267 additions and 61 deletions

View File

@ -0,0 +1,27 @@
From 49f827b09db549de62dcaf8b90b3fcb3e08c0ee5 Mon Sep 17 00:00:00 2001
From: Serge Guelton <sguelton@redhat.com>
Date: Mon, 6 Mar 2023 12:37:48 +0100
Subject: [PATCH] Make -funwind-tables the default on all archs
---
clang/lib/Driver/ToolChains/Gnu.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index 24fbdcffc07b..8fed46b49515 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -3082,6 +3082,10 @@ Generic_GCC::getDefaultUnwindTableLevel(const ArgList &Args) const {
case llvm::Triple::riscv64be:
case llvm::Triple::x86:
case llvm::Triple::x86_64:
+ // Enable -funwind-tables on all architectures supported by Fedora:
+ // rhbz#1655546
+ case llvm::Triple::systemz:
+ case llvm::Triple::arm:
return UnwindTableLevel::Asynchronous;
default:
return UnwindTableLevel::None;
--
2.39.1

86
22-185375.patch Normal file
View File

@ -0,0 +1,86 @@
From f463bef09be73ae9a415fcd3fd49689bd95b0f0a Mon Sep 17 00:00:00 2001
From: Congcong Cai <congcongcai0907@163.com>
Date: Fri, 20 Feb 2026 07:03:27 +0800
Subject: [PATCH] [SimplifyCFG] process prof data when remove case in umin
(#182261)
In #164097, we introduce a optimization for umin. But it does not handle
profile data correctly.
This PR remove profile data when remove cases.
Fixed: #181837
(cherry picked from commit 31e5f86a3cdc960ef7b2f0a533c4a37cf526cacd)
---
llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 2 +-
.../Transforms/SimplifyCFG/switch-umin.ll | 43 +++++++++++++++++++
2 files changed, 44 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 5f4807242581d..a16f274a4ed5a 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -7724,7 +7724,7 @@ static bool simplifySwitchWhenUMin(SwitchInst *SI, DomTreeUpdater *DTU) {
BasicBlock *DeadCaseBB = I->getCaseSuccessor();
DeadCaseBB->removePredecessor(BB);
Updates.push_back({DominatorTree::Delete, BB, DeadCaseBB});
- I = SIW->removeCase(I);
+ I = SIW.removeCase(I);
E = SIW->case_end();
}
diff --git a/llvm/test/Transforms/SimplifyCFG/switch-umin.ll b/llvm/test/Transforms/SimplifyCFG/switch-umin.ll
index 44665365dc222..ff958e4d04147 100644
--- a/llvm/test/Transforms/SimplifyCFG/switch-umin.ll
+++ b/llvm/test/Transforms/SimplifyCFG/switch-umin.ll
@@ -239,8 +239,51 @@ case4:
}
+define void @switch_remove_dead_cases(i32 %x) {
+; CHECK-LABEL: define void @switch_remove_dead_cases(
+; CHECK-SAME: i32 [[X:%.*]]) {
+; CHECK-NEXT: [[MIN:%.*]] = call i32 @llvm.umin.i32(i32 [[X]], i32 4)
+; CHECK-NEXT: switch i32 [[X]], label %[[COMMON_RET:.*]] [
+; CHECK-NEXT: i32 2, label %[[CASE_A:.*]]
+; CHECK-NEXT: i32 3, label %[[CASE_B:.*]]
+; CHECK-NEXT: ], !prof [[PROF1:![0-9]+]]
+; CHECK: [[COMMON_RET]]:
+; CHECK-NEXT: ret void
+; CHECK: [[CASE_A]]:
+; CHECK-NEXT: call void @a()
+; CHECK-NEXT: br label %[[COMMON_RET]]
+; CHECK: [[CASE_B]]:
+; CHECK-NEXT: call void @b()
+; CHECK-NEXT: br label %[[COMMON_RET]]
+;
+ %min = call i32 @llvm.umin.i32(i32 %x, i32 4)
+ switch i32 %min, label %unreachable [
+ i32 2, label %case_a
+ i32 3, label %case_b
+ i32 4, label %case_ret
+ i32 5, label %case_ret
+ ], !prof !1
+
+case_a:
+ call void @a()
+ ret void
+
+case_b:
+ call void @b()
+ ret void
+
+case_ret:
+ ret void
+
+unreachable:
+ unreachable
+}
!0 = !{!"branch_weights", i32 1, i32 2, i32 3, i32 99, i32 5}
;.
; CHECK: [[PROF0]] = !{!"branch_weights", i32 5, i32 2, i32 3, i32 99}
;.
+!1 = !{!"branch_weights", i32 11, i32 12, i32 13, i32 14, i32 15}
+;.
+; CHECK: [[PROF1]] = !{!"branch_weights", i32 14, i32 12, i32 13}
+;.

55
22-185922.patch Normal file
View File

@ -0,0 +1,55 @@
From ccf0ee68b86f65a6a4e83756f717faad7c779cb1 Mon Sep 17 00:00:00 2001
From: Nikita Popov <npopov@redhat.com>
Date: Wed, 11 Mar 2026 18:03:05 +0100
Subject: [PATCH] [SystemZ] Limit depth of findCCUse()
The recursion here has potentially exponential complexity. Avoid
this by limiting the depth of recursion.
An alternative would be to memoize the results. I went with the
simpler depth limit on the assumption that we don't particularly
care about very deep value chains here.
---
llvm/lib/Target/SystemZ/SystemZISelLowering.cpp | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
index 2a9cb903f3921..84d66f88a812d 100644
--- a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
@@ -8692,7 +8692,12 @@ SDValue SystemZTargetLowering::combineSETCC(
return SDValue();
}
-static std::pair<SDValue, int> findCCUse(const SDValue &Val) {
+static std::pair<SDValue, int> findCCUse(const SDValue &Val,
+ unsigned Depth = 0) {
+ // Limit depth of potentially exponential walk.
+ if (Depth > 5)
+ return std::make_pair(SDValue(), SystemZ::CCMASK_NONE);
+
switch (Val.getOpcode()) {
default:
return std::make_pair(SDValue(), SystemZ::CCMASK_NONE);
@@ -8705,7 +8710,7 @@ static std::pair<SDValue, int> findCCUse(const SDValue &Val) {
SDValue Op4CCReg = Val.getOperand(4);
if (Op4CCReg.getOpcode() == SystemZISD::ICMP ||
Op4CCReg.getOpcode() == SystemZISD::TM) {
- auto [OpCC, OpCCValid] = findCCUse(Op4CCReg.getOperand(0));
+ auto [OpCC, OpCCValid] = findCCUse(Op4CCReg.getOperand(0), Depth + 1);
if (OpCC != SDValue())
return std::make_pair(OpCC, OpCCValid);
}
@@ -8722,10 +8727,10 @@ static std::pair<SDValue, int> findCCUse(const SDValue &Val) {
case ISD::SHL:
case ISD::SRA:
case ISD::SRL:
- auto [Op0CC, Op0CCValid] = findCCUse(Val.getOperand(0));
+ auto [Op0CC, Op0CCValid] = findCCUse(Val.getOperand(0), Depth + 1);
if (Op0CC != SDValue())
return std::make_pair(Op0CC, Op0CCValid);
- return findCCUse(Val.getOperand(1));
+ return findCCUse(Val.getOperand(1), Depth + 1);
}
}

View File

@ -13,7 +13,7 @@ rules:
--- !Policy
product_versions:
# The version number here should match the current rawhide release.
- fedora-44
- fedora-45
decision_contexts:
- bodhi_update_push_stable
- bodhi_update_push_stable_critpath

156
llvm.spec
View File

@ -1,8 +1,8 @@
#region globals
#region version
%global maj_ver 21
%global maj_ver 22
%global min_ver 1
%global patch_ver 8
%global patch_ver 1
#global rc_ver rc3
%bcond_with snapshot_build
@ -11,7 +11,6 @@
%endif
#endregion version
# Components enabled if supported by target architecture:
%define gold_arches %{ix86} x86_64 aarch64 %{power64} s390x
%ifarch %{gold_arches}
@ -35,7 +34,6 @@
%define bcond_override_default_libcxx 0
%define bcond_override_default_lto_build 0
%define bcond_override_default_check 0
%define _find_debuginfo_dwz_opts %{nil}
%endif
# Build compat packages llvmN instead of main package for the current LLVM
@ -43,11 +41,11 @@
%bcond_with compat_build
# Bundle compat libraries for a previous LLVM version, as part of llvm-libs and
# clang-libs. Used on RHEL.
%bcond_with bundle_compat_lib
%bcond_without bundle_compat_lib
%bcond_without check
%if %{with bundle_compat_lib}
%global compat_maj_ver 20
%global compat_maj_ver 21
%global compat_ver %{compat_maj_ver}.1.8
%endif
@ -469,7 +467,9 @@ Source1001: changelog
# behind the latest packaged LLVM version.
#region CLANG patches
Patch101: 0001-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch
Patch2100: 0001-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch
Patch2200: 0001-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch
Patch2300: 0001-23-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch
Patch102: 0003-PATCH-clang-Don-t-install-static-libraries.patch
Patch2002: 20-131099.patch
@ -486,6 +486,14 @@ Patch104: 0001-Driver-Give-devtoolset-path-precedence-over-Installe.patch
# (https://github.com/llvm/llvm-project/pull/124743 landed in LLVM 21)
Patch2003: 0001-cmake-Resolve-symlink-when-finding-install-prefix.patch
# Backport a fix from LLVM 23.
# https://github.com/llvm/llvm-project/pull/185375
Patch2204: 22-185375.patch
# Backport a fix for high CPU usage on s390x from LLVM 23.
# https://github.com/llvm/llvm-project/pull/185922
Patch2205: 22-185922.patch
#region LLD patches
Patch106: 0001-19-Always-build-shared-libs-for-LLD.patch
Patch2103: 0001-lld-Adjust-compressed-debug-level-test-for-s390x-wit.patch
@ -627,20 +635,17 @@ BuildRequires: gnupg2
BuildRequires: swig
BuildRequires: libxml2-devel
BuildRequires: doxygen
# For clang-offload-packager
BuildRequires: elfutils-libelf-devel
BuildRequires: perl
BuildRequires: perl-Data-Dumper
BuildRequires: perl-Encode
BuildRequires: libffi-devel
# For scan-build
BuildRequires: perl-interpreter
BuildRequires: perl-generators
# According to https://fedoraproject.org/wiki/Packaging:Emacs a package
# should BuildRequires: emacs if it packages emacs integration files.
BuildRequires: emacs
# We only need the emacs packaging macros, which are part of emacs-common.
BuildRequires: emacs-common
BuildRequires: libatomic
@ -665,8 +670,6 @@ BuildRequires: python%{python3_pkgversion}-pyyaml
BuildRequires: python%{python3_pkgversion}-nanobind-devel
%endif
BuildRequires: graphviz
# This is required because we need "ps" when running LLDB tests
BuildRequires: procps-ng
@ -1337,9 +1340,7 @@ Flang runtime libraries.
#region LLVM preparation
%py3_shebang_fix \
llvm/test/BugPoint/compile-custom.ll.py \
llvm/tools/opt-viewer/*.py \
llvm/utils/update_cc_test_checks.py
llvm/tools/opt-viewer/*.py
#endregion LLVM preparation
@ -1479,11 +1480,9 @@ export ASMFLAGS="%{build_cflags}"
# We set CLANG_DEFAULT_PIE_ON_LINUX=OFF and PPC_LINUX_DEFAULT_IEEELONGDOUBLE=ON to match the
# defaults used by Fedora's GCC.
# Disable dwz on aarch64, because it takes a huge amount of time to decide not to optimize things.
# This is copied from clang.
%ifarch aarch64 riscv64
# Disable dwz because it takes a huge amount of time to decide not to
# optimize things.
%define _find_debuginfo_dwz_opts %{nil}
%endif
cd llvm
@ -1870,12 +1869,14 @@ fi
-DLLVM_VP_COUNTERS_PER_SITE=8
%if %{defined host_clang_maj_ver}
%global cmake_config_args_instrumented %{cmake_config_args_instrumented} \\\
-DLLVM_PROFDATA=%{_bindir}/llvm-profdata-%{host_clang_maj_ver}
%global profdata %{_bindir}/llvm-profdata-%{host_clang_maj_ver}
%global cxxfilt %{_bindir}/llvm-cxxfilt-%{host_clang_maj_ver}
%else
%global cmake_config_args_instrumented %{cmake_config_args_instrumented} \\\
-DLLVM_PROFDATA=%{_bindir}/llvm-profdata
%global profdata %{_bindir}/llvm-profdata
%global cxxfilt %{_bindir}/llvm-cxxfilt
%endif
%global cmake_config_args_instrumented %{cmake_config_args_instrumented} \\\
-DLLVM_PROFDATA=%{profdata}
# TODO(kkleine): Should we see warnings like:
# "function control flow change detected (hash mismatch)"
@ -1894,10 +1895,14 @@ fi
%cmake_build --target generate-profdata
# Show top 10 functions in the profile
llvm-profdata show --topn=10 %{builddir_instrumented}/tools/clang/utils/perf-training/clang.profdata | llvm-cxxfilt
%{profdata} show --topn=10 %{builddir_instrumented}/tools/clang/utils/perf-training/clang.profdata | %{cxxfilt}
cp %{builddir_instrumented}/tools/clang/utils/perf-training/clang.profdata $RPM_BUILD_DIR/result.profdata
# The instrumented files are not needed anymore.
# Remove them in order to free disk space (~10GiB).
rm -rf %{builddir_instrumented}
#endregion Perf training
%endif
@ -1975,7 +1980,17 @@ cd $OLD_CWD
%cmake_build --target runtimes
#endregion Final stage
#endregion Performance comparison
%if %{with lto_build}
# The LTO cache is not needed anymore.
# Remove it in order to free disk space.
rm -rfv %{_vpath_builddir}/lto.cache
%endif
# Strip debug info from static libraries before the install phase because
# LLVM already consumes a lot of disk space (i.e. > 150GiB).
# The install phase duplicates files on disk, causing errors if the disk is
# too small.
RPM_BUILD_ROOT=$(realpath ..)/%{build_libdir} %__brp_strip_static_archive
#region compat lib
cd ..
@ -2176,9 +2191,6 @@ chmod a+x %{buildroot}%{install_datadir}/scan-view/{Reporter.py,startfile.py}
rm -vf %{buildroot}%{install_datadir}/clang/clang-format-bbedit.applescript
rm -vf %{buildroot}%{install_datadir}/clang/clang-format-sublime.py*
# Remove unpackaged files
rm -Rvf %{buildroot}%{install_datadir}/clang-doc
# TODO: What are the Fedora guidelines for packaging bash autocomplete files?
rm -vf %{buildroot}%{install_datadir}/clang/bash-autocomplete.sh
@ -2515,6 +2527,9 @@ function reset_test_opts()
# Some test (e.g. mlir) require this to be set.
unset PYTHONPATH
# We use them in some cases.
unset LIT_NUM_SHARDS LIT_RUN_SHARD
}
# Convert array of test names into a regex.
@ -2579,13 +2594,31 @@ export LIT_XFAIL="tools/UpdateTestChecks"
reset_test_opts
export LIT_XFAIL="$LIT_XFAIL;clang/test/CodeGen/profile-filter.c"
%ifarch riscv64
export LIT_XFAIL="$LIT_XFAIL;clang/test/OpenMP/declare_variant_device_isa_codegen_1.c"
export LIT_XFAIL="$LIT_XFAIL;OpenMP/declare_variant_device_isa_codegen_1.c"
test_list_filter_out+=("Clang :: OpenMP/declare_variant_device_isa_codegen_1.c")
%endif
%ifarch %ix86
# These tests have been reaching a limit on small i386 servers.
# We don't know exactly which limit is being reached, but python prints
# "RuntimeError: can't start new thread". The issue appears to be related to
# a large number of threads being created very closely while running Sema*
# tests. The failing tests vary from time to time and are usually simple
# tests. The execution appears to recover later, with new threads getting
# created and completing the execution of the remaining tests.
# In order to reduce the number of threads getting created, we split the
# tests in 5 shards, ensuring that less than 5K tests will be executed each
# time.
export LIT_NUM_SHARDS=5
for i in $(seq $LIT_NUM_SHARDS); do
export LIT_RUN_SHARD=$i
%ifarch riscv64
export LIT_XFAIL="$LIT_XFAIL;clang/test/OpenMP/declare_variant_device_isa_codegen_1.c"
export LIT_XFAIL="$LIT_XFAIL;OpenMP/declare_variant_device_isa_codegen_1.c"
test_list_filter_out+=("Clang :: OpenMP/declare_variant_device_isa_codegen_1.c")
%endif
%ifnarch riscv64
%ifnarch riscv64
%cmake_build --target check-clang
%endif
done
%else
%cmake_build --target check-clang
%endif
#endregion Test Clang
@ -3059,7 +3092,6 @@ fi
%license llvm/LICENSE.TXT
%{expand_bins %{expand:
bugpoint
dsymutil
FileCheck
llc
@ -3155,8 +3187,18 @@ fi
}}
%endif
%{expand_mans %{expand:
%if %{maj_ver} >= 23
%{expand_bins %{expand:
llubi
llvm-gpu-loader
}}
%else
%{expand_bins %{expand:
bugpoint
}}
%endif
%{expand_mans %{expand:
clang-tblgen
dsymutil
FileCheck
@ -3220,6 +3262,16 @@ fi
}}
%endif
%if %{maj_ver} >= 23
%{expand_mans %{expand:
llubi
}}
%else
%{expand_mans %{expand:
bugpoint
}}
%endif
%expand_datas opt-viewer
%files -n %{pkg_name_llvm}-libs
@ -3456,6 +3508,7 @@ fi
clang/clang-include-fixer.py*
clang/clang-tidy-diff.py*
clang/run-find-all-symbols.py*
clang-doc/*
}}
%files -n %{pkg_name_clang}-tools-extra-devel
@ -3720,26 +3773,9 @@ fi
}}
%{install_bindir}/flang-%{maj_ver}
%{expand_includes %{expand:
flang/__cuda_builtins.mod
flang/__cuda_device.mod
flang/__fortran_builtins.mod
flang/__fortran_ieee_exceptions.mod
flang/__fortran_type_info.mod
flang/__ppc_intrinsics.mod
flang/__ppc_types.mod
flang/cooperative_groups.mod
flang/ieee_arithmetic.mod
flang/ieee_exceptions.mod
flang/ieee_features.mod
flang/iso_c_binding.mod
flang/iso_fortran_env.mod
flang/mma.mod
flang/cudadevice.mod
flang/iso_fortran_env_impl.mod
flang/omp_lib.mod
flang/omp_lib_kinds.mod
flang/flang_debug.mod
flang/*.mod
}}
%{_sysconfdir}/%{pkg_name_clang}/%{_target_platform}-flang.cfg
%ifarch x86_64
%{_sysconfdir}/%{pkg_name_clang}/i386-redhat-linux-gnu-flang.cfg
@ -3851,7 +3887,7 @@ fi
#endregion files
%changelog
* Mon Mar 16 2026 Eduard Abdullin <eabdullin@almalinux.org> - 21.1.8-1.alma.1
* Mon Apr 13 2026 Eduard Abdullin <eabdullin@almalinux.org> - 22.1.1-1.alma.1
- AlmaLinux change: Use x86_64-redhat-linux as default gcc triple for x86_64_v2
- Add riscv64 support

View File

@ -1,2 +1,4 @@
SHA512 (llvm-project-21.1.8.src.tar.xz.sig) = 10f58eff58ed6e701d0f123b15e68c82ab8cbdf99b1c86c0d83e3b8553e90ea51055e30327e8e442ded57c8f503e2a2de9ee075e9c28b5ba815a0f8922f8671c
SHA512 (llvm-project-21.1.8.src.tar.xz) = cae4c44e7bf678071723da63ad5839491d717a7233e7f4791aa408207f3ea42f52de939ad15189b112c02a0770f1bb8d59bae6ad31ef53417a6eea7770fe52ab
SHA512 (llvm-project-22.1.1.src.tar.xz) = dddf09651c0e77caa83284788765016b023a9e239cfe35820bab7be64b68218e86bcf39bb07ee14dcddf7b0974b551344d2bff0e109cc9458b0394a3c940917c
SHA512 (llvm-project-22.1.1.src.tar.xz.sig) = 592d603d610e121e7466a342bbf6b95c9a5f689268fad778befbf9e5663b53717c50daab9db07288020e3dcc2ec2bf38d611761a9ff6c3ce10a4340cfc2593c7