Update to LLVM 22.1.8

Resolves: RHEL-140432
Resolves: RHEL-140429
Related: RHEL-140438
Related: RHEL-140434
This commit is contained in:
Nikita Popov 2026-06-25 09:51:19 +02:00
parent 20986fa8fc
commit f16b24b7a9
8 changed files with 4397 additions and 284 deletions

File diff suppressed because it is too large Load Diff

70
0b6a1ef429.patch Normal file
View File

@ -0,0 +1,70 @@
From 0b6a1ef4297bb839fe26041602d32411358e0032 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Tue, 26 May 2026 01:41:01 +0200
Subject: [PATCH] [lit] Normalize RLIM_INFINITY to "infinity" in
print_limits.py for Python 3.15+ (#190953)
Python 3.15 changed resource.getrlimit() to return the platform's
maximum value (e.g., 18446744073709551615 on 64-bit systems) instead of
-1 for RLIM_INFINITY. This breaks lit tests that expect -1 for unlimited
resource limits.
This patch normalizes the return value to "infinity" when it equals
RLIM_INFINITY to maintain compatibility with existing tests across all
Python versions.
Fixes test failure: shtest-ulimit-nondarwin.py
Expected: RLIMIT_FSIZE=-1
Got: RLIMIT_FSIZE=18446744073709551615
Reference:
https://github.com/python/cpython/commit/0324c726dea702282a0300225e989b19ae23b759
Reference: https://bugzilla.redhat.com/show_bug.cgi?id=2448969
Analysis and testing assisted by AI.
Assisted-by: Claude Sonnet 4.5
---------
Co-authored-by: Alexander Richardson <mail@alexrichardson.me>
Co-authored-by: Tulio Magno Quites Machado Filho <tuliom@quites.com.br>
---
.../tests/Inputs/shtest-ulimit/print_limits.py | 17 +++++++++++++----
llvm/utils/lit/tests/shtest-ulimit-nondarwin.py | 2 +-
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/llvm/utils/lit/tests/Inputs/shtest-ulimit/print_limits.py b/llvm/utils/lit/tests/Inputs/shtest-ulimit/print_limits.py
index c732c0429e661..6c03721baf36d 100644
--- a/llvm/utils/lit/tests/Inputs/shtest-ulimit/print_limits.py
+++ b/llvm/utils/lit/tests/Inputs/shtest-ulimit/print_limits.py
@@ -1,6 +1,15 @@
import resource
-print("RLIMIT_AS=" + str(resource.getrlimit(resource.RLIMIT_AS)[0]))
-print("RLIMIT_NOFILE=" + str(resource.getrlimit(resource.RLIMIT_NOFILE)[0]))
-print("RLIMIT_STACK=" + str(resource.getrlimit(resource.RLIMIT_STACK)[0]))
-print("RLIMIT_FSIZE=" + str(resource.getrlimit(resource.RLIMIT_FSIZE)[0]))
+
+def normalize_limit(limit_value):
+ """Normalize RLIM_INFINITY to "infinity" for consistency across Python versions.
+
+ Python 3.15+ returns the platform's max value (e.g., 2^64-1) instead of -1.
+ """
+ return "infinity" if limit_value == resource.RLIM_INFINITY else str(limit_value)
+
+
+print("RLIMIT_AS=" + normalize_limit(resource.getrlimit(resource.RLIMIT_AS)[0]))
+print("RLIMIT_NOFILE=" + normalize_limit(resource.getrlimit(resource.RLIMIT_NOFILE)[0]))
+print("RLIMIT_STACK=" + normalize_limit(resource.getrlimit(resource.RLIMIT_STACK)[0]))
+print("RLIMIT_FSIZE=" + normalize_limit(resource.getrlimit(resource.RLIMIT_FSIZE)[0]))
diff --git a/llvm/utils/lit/tests/shtest-ulimit-nondarwin.py b/llvm/utils/lit/tests/shtest-ulimit-nondarwin.py
index 43811db750f80..80844d1d79460 100644
--- a/llvm/utils/lit/tests/shtest-ulimit-nondarwin.py
+++ b/llvm/utils/lit/tests/shtest-ulimit-nondarwin.py
@@ -18,4 +18,4 @@
# CHECK: ulimit -f 5
# CHECK: RLIMIT_FSIZE=5
# CHECK: ulimit -f unlimited
-# CHECK: RLIMIT_FSIZE=-1
+# CHECK: RLIMIT_FSIZE=infinity

View File

@ -1,86 +0,0 @@
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}
+;.

View File

@ -1,55 +0,0 @@
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

@ -1,87 +0,0 @@
From 3915d1efcdb1e9d10c8f6966acbe5c359d824ba1 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Mon, 6 Apr 2026 14:08:10 -0700
Subject: [PATCH] [CodeGen] Preserve big-endian trunc in concat_vectors
A transform from `concat_vectors(trunc(scalar), undef)` to
`scalar_to_vector(scalar)` is only equivalent for little-endian targets.
On big-endian, that would put the extra upper bytes ahead of the desired
truncated bytes. This problem was seen on Rust s390x in [RHEL-147748].
[RHEL-147748]: https://redhat.atlassian.net/browse/RHEL-147748
Assisted-by: Claude Code
---
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 4 +-
llvm/test/CodeGen/SystemZ/vec-trunc-to-i16.ll | 45 +++++++++++++++++++
2 files changed, 48 insertions(+), 1 deletion(-)
create mode 100644 llvm/test/CodeGen/SystemZ/vec-trunc-to-i16.ll
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 383e45c5ea3a8..5485ee86251a5 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -26513,9 +26513,11 @@ SDValue DAGCombiner::visitCONCAT_VECTORS(SDNode *N) {
// If the bitcast type isn't legal, it might be a trunc of a legal type;
// look through the trunc so we can still do the transform:
// concat_vectors(trunc(scalar), undef) -> scalar_to_vector(scalar)
+ // However, this is only equivalent on little-endian targets.
if (Scalar->getOpcode() == ISD::TRUNCATE &&
!TLI.isTypeLegal(Scalar.getValueType()) &&
- TLI.isTypeLegal(Scalar->getOperand(0).getValueType()))
+ TLI.isTypeLegal(Scalar->getOperand(0).getValueType()) &&
+ DAG.getDataLayout().isLittleEndian())
Scalar = Scalar->getOperand(0);
EVT SclTy = Scalar.getValueType();
diff --git a/llvm/test/CodeGen/SystemZ/vec-trunc-to-i16.ll b/llvm/test/CodeGen/SystemZ/vec-trunc-to-i16.ll
new file mode 100644
index 0000000000000..42d787d945145
--- /dev/null
+++ b/llvm/test/CodeGen/SystemZ/vec-trunc-to-i16.ll
@@ -0,0 +1,45 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
+
+; Test that truncated scalars use the correct vector insert instruction.
+; On big-endian targets, concat_vectors should not skip truncates when
+; creating scalar_to_vector, as the bytes would be in the wrong position.
+
+; This truncated i16 should use vlvgh (insert halfword), not vlvgf (insert fullword).
+define <16 x i8> @test_concat_trunc_i16(i32 %x) {
+; CHECK-LABEL: test_concat_trunc_i16:
+; CHECK: # %bb.0:
+; CHECK-NEXT: vlvgh %v24, %r2, 0
+; CHECK-NEXT: br %r14
+ %t = trunc i32 %x to i16
+ %vec = bitcast i16 %t to <2 x i8>
+ %result = shufflevector <2 x i8> %vec, <2 x i8> poison, <16 x i32> <i32 0, i32 1, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
+ ret <16 x i8> %result
+}
+
+; Test with a more complex shuffle pattern, reduced from a Rust bug report.
+define fastcc void @test_shuffle_with_trunc() {
+; CHECK-LABEL: test_shuffle_with_trunc:
+; CHECK: # %bb.0:
+; CHECK-NEXT: lh %r1, 0
+; CHECK-NEXT: l %r0, 0
+; CHECK-NEXT: vlvgh %v1, %r1, 0
+; CHECK-NEXT: larl %r1, .LCPI1_0
+; CHECK-NEXT: vl %v2, 0(%r1), 3
+; CHECK-NEXT: vlvgf %v0, %r0, 0
+; CHECK-NEXT: vperm %v0, %v0, %v1, %v2
+; CHECK-NEXT: vst %v0, 0, 3
+; CHECK-NEXT: br %r14
+ %1 = load i32, ptr null, align 8
+ %2 = load i16, ptr null, align 1
+ br label %3
+
+3:
+ %4 = bitcast i32 %1 to <4 x i8>
+ %5 = shufflevector <4 x i8> %4, <4 x i8> zeroinitializer, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
+ %6 = bitcast i16 %2 to <2 x i8>
+ %7 = shufflevector <2 x i8> %6, <2 x i8> zeroinitializer, <16 x i32> <i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 0, i32 1, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
+ %8 = shufflevector <16 x i8> %5, <16 x i8> %7, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 25, i32 26, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
+ store <16 x i8> %8, ptr null, align 8
+ ret void
+}

View File

@ -1,3 +1,6 @@
* Thu Jun 25 2026 Nikita Popov <npopov@redhat.com> - 22.1.8-1
- Update to LLVM 22.1.8
* Wed Apr 22 2026 Nikita Popov <npopov@redhat.com> - 22.1.3-1
- Update to LLVM 22.1.3

218
llvm.spec
View File

@ -2,7 +2,7 @@
#region version
%global maj_ver 22
%global min_ver 1
%global patch_ver 3
%global patch_ver 8
#global rc_ver rc3
%bcond_with snapshot_build
@ -42,7 +42,7 @@
%bcond_with compat_build
# Bundle compat libraries for a previous LLVM version, as part of llvm-libs and
# clang-libs. Used on RHEL.
%bcond_without bundle_compat_lib
%bcond_with bundle_compat_lib
%bcond_without check
%if %{with bundle_compat_lib}
@ -57,6 +57,14 @@
%bcond_without python_lit
%endif
%if %{maj_ver} >= 23
%global build_docs 0
%global build_docs_toggle OFF
%else
%global build_docs 1
%global build_docs_toggle ON
%endif
%bcond_without lldb
%ifarch ppc64le
@ -209,15 +217,16 @@ end
%endif
%endif
# Historically, LLD was used used at the same combinations that enabled PGO.
# If this changes, we need to update the following lines.
# However, we should be able to link using LLD even if PGO is disabled.
# Reminder: RHEL8 still builds with gcc + ld.bfd.
%if %{with pgo}
%bcond_without use_lld
%else
%if 0%{?rhel} == 8
# RHEL8 still builds with gcc + ld.bfd.
%bcond_with use_lld
%else
%bcond_without use_lld
%endif
%if %{with pgo} && %{without use_lld}
%{error:PGO requires --with=lld}
%endif
# For PGO Disable LTO for now because of LLVMgold.so not found error
@ -263,6 +272,12 @@ end
%bcond_without libedit
%endif
%if %{defined rhel} && 0%{?rhel} >= 10
%bcond_with multilib
%else
%bcond_without multilib
%endif
# Opt out of https://fedoraproject.org/wiki/Changes/fno-omit-frame-pointer
# https://bugzilla.redhat.com/show_bug.cgi?id=2158587
%undefine _include_frame_pointers
@ -279,8 +294,10 @@ end
# Suffixless tarball name (essentially: basename -s .tar.xz llvm-project-17.0.6.src.tar.xz)
%if %{with snapshot_build}
%global src_tarball_dir llvm-project-%{llvm_snapshot_git_revision}
%global src_manpage_tarball_dir llvm_man_pages-%{llvm_snapshot_yyyymmdd}
%else
%global src_tarball_dir llvm-project-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:-%{rc_ver}}.src
%global src_manpage_tarball_dir llvm_man_pages-%{maj_ver}.%{min_ver}.%{patch_ver}
%endif
# LLD uses "fast" as the algortithm for generating build-id
@ -437,9 +454,15 @@ URL: http://llvm.org
%if %{with snapshot_build}
Source0: https://github.com/llvm/llvm-project/archive/%{llvm_snapshot_git_revision}.tar.gz
%if %{build_docs} == 0
Source42: https://github.com/fedora-llvm-team/llvm-snapshots/releases/download/snapshot-version-sync/%{src_manpage_tarball_dir}.tar.xz
%endif
%else
Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:-%{rc_ver}}/%{src_tarball_dir}.tar.xz
Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:-%{rc_ver}}/%{src_tarball_dir}.tar.xz.sig
%if %{build_docs} == 0
Source42: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:-%{rc_ver}}/%{src_manpage_tarball_dir}.tar.xz
%endif
%endif
Source6: release-keys.asc
@ -501,6 +524,12 @@ Patch103: 0001-Workaround-a-bug-in-ORC-on-ppc64le.patch
Patch104: 0001-Driver-Give-devtoolset-path-precedence-over-Installe.patch
#endregion CLANG patches
# Fix lit tests for Python 3.15+ https://bugzilla.redhat.com/show_bug.cgi?id=2448969
Patch2209: https://github.com/llvm/llvm-project/commit/0b6a1ef429.patch
# s390x fix for unaligned memory access performance regressions.
Patch2210: 0001-SystemZ-Avoid-unaligned-VL-VST-s-with-memcpy-memmove.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
@ -539,9 +568,6 @@ Patch2105: 43cb4631c1f42dbfce78288b8ae30b5840ed59b3.patch
# Fix for s390x vector miscompilation (rhbz#2430017)
Patch2106: 0001-SystemZ-Fix-code-in-widening-vector-multiplication-1.patch
# Fix for s390x vector miscompilation (RHEL-147748)
Patch2203: 22-190701.patch
%if 0%{?rhel} == 8
%global python3_pkgversion 3.12
%global __python3 /usr/bin/python3.12
@ -591,20 +617,22 @@ BuildRequires: lld
%endif
%endif
%if %{build_docs}
# This intentionally does not use python3_pkgversion. RHEL 8 does not have
# python3.12-sphinx, and we are only using it as a binary anyway.
BuildRequires: python3-sphinx
%if 0%{?rhel} != 8
# RHEL 8 does not have these packages for python3.12. However, they are only
# needed for LLDB tests.
BuildRequires: python%{python3_pkgversion}-psutil
BuildRequires: python%{python3_pkgversion}-pexpect
%endif
%if %{undefined rhel}
%if 0%{?rhel} != 8
# RHEL 8 does not have these packages for python3.12.
BuildRequires: python%{python3_pkgversion}-psutil
%endif
%if %{undefined rhel} && %{build_docs}
BuildRequires: python%{python3_pkgversion}-myst-parser
%endif
# Needed for %%multilib_fix_c_header
%if %{with multilib}
BuildRequires: multilib-rpm-config
%endif
%if %{with gold}
BuildRequires: binutils-devel
%if %{undefined rhel} || 0%{?rhel} > 8
@ -925,7 +953,7 @@ Development header files for clang tools.
%package -n git-clang-format%{pkg_suffix}
Summary: Integration of clang-format for git
Requires: %{pkg_name_clang}-tools-extra = %{version}-%{release}
Requires: git
Requires: git-core
Requires: python%{python3_pkgversion}
%description -n git-clang-format%{pkg_suffix}
@ -1055,6 +1083,9 @@ License: Apache-2.0 WITH LLVM-exception OR NCSA
URL: http://lldb.llvm.org/
Requires: %{pkg_name_clang}-libs%{?_isa} = %{version}-%{release}
%if 0%{?fedora} >= 45
Recommends: yama-ptrace-enable
%endif
%if %{without compat_build}
Requires: python%{python3_pkgversion}-lldb
%endif
@ -1325,8 +1356,9 @@ targets is welcome.
Summary: Spirv subset of %{name}
%description -n %{pkg_name_libclc}-spirv
The %{pkg_name_libclc}-spirv package contains the spirv*-mesa3d-.spv files only,
which are the subset required for upstream Mesa OpenCL support with RustiCL.
The %{pkg_name_libclc}-spirv package contains the spirv32-unknown-unknown/libclc.spv and
spirv64-unknown-unknown/libclc.spv files only, which are the subset required for upstream
Mesa OpenCL support with RustiCL.
%endif
#endregion libclc packages
@ -1359,6 +1391,11 @@ which are the subset required for upstream Mesa OpenCL support with RustiCL.
%endif
# Unpack the man pages first
%if %{build_docs} == 0
%autosetup -N -T -b 42 -n %{src_manpage_tarball_dir}
%endif
# -T : Do Not Perform Default Archive Unpacking (without this, the <n>th source would be unpacked twice)
# -b <n> : Unpack The nth Sources Before Changing Directory
# -n : Set Name of Build Directory
@ -1409,10 +1446,12 @@ which are the subset required for upstream Mesa OpenCL support with RustiCL.
#endregion COMPILER-RT preparation
#region lldb preparation
%if %{build_docs}
# Compat builds don't build python bindings, but should still build man pages.
%if %{with compat_build}
sed -i 's/LLDB_ENABLE_PYTHON/TRUE/' lldb/docs/CMakeLists.txt
%endif
%endif
#endregion
#region libcxx preparation
@ -1454,6 +1493,8 @@ cd llvm/utils/lit
%global projects clang;clang-tools-extra;lld
%global runtimes compiler-rt;openmp
%global runtime_targets default
%if %{with lldb}
%global projects %{projects};lldb
%endif
@ -1481,10 +1522,15 @@ cd llvm/utils/lit
%if %{with offload}
%global runtimes %{runtimes};offload
%global runtime_targets %{runtime_targets};amdgcn-amd-amdhsa
%endif
%if %{with libclc} || %{with offload}
%global runtime_targets %{runtime_targets};nvptx64-nvidia-cuda
%endif
%if %{with libclc}
%global runtimes %{runtimes};libclc
%global runtime_targets %{runtime_targets};spirv32-unknown-unknown;spirv64-unknown-unknown;amdgcn-amd-amdhsa-llvm
%endif
%global gcc_triple --gcc-triple=%{_target_cpu}-redhat-linux
@ -1602,7 +1648,7 @@ CLANG_LDFLAGS=$(strip_specs "$LDFLAGS $CLANG_LDFLAGS_EXTRA")
-DCLANG_DEFAULT_UNWINDLIB=libgcc \\\
-DCLANG_ENABLE_ARCMT:BOOL=ON \\\
-DCLANG_ENABLE_STATIC_ANALYZER:BOOL=ON \\\
-DCLANG_INCLUDE_DOCS:BOOL=ON \\\
-DCLANG_INCLUDE_DOCS:BOOL=%{build_docs_toggle} \\\
-DCLANG_INCLUDE_TESTS:BOOL=ON \\\
-DCLANG_PLUGIN_SUPPORT:BOOL=ON \\\
-DCLANG_REPOSITORY_STRING="%{?dist_vendor} %{version}-%{release}" \\\
@ -1629,15 +1675,15 @@ CLANG_LDFLAGS=$(strip_specs "$LDFLAGS $CLANG_LDFLAGS_EXTRA")
# Add all *enabled* documentation targets (no doxygen but sphinx)
%global cmake_config_args %{cmake_config_args} \\\
-DLLVM_ENABLE_DOXYGEN:BOOL=OFF \\\
-DLLVM_ENABLE_SPHINX:BOOL=ON \\\
-DLLVM_BUILD_DOCS:BOOL=ON
-DLLVM_ENABLE_SPHINX:BOOL=%{build_docs_toggle} \\\
-DLLVM_BUILD_DOCS:BOOL=%{build_docs_toggle}
# Configure sphinx:
# Build man-pages but no HTML docs using sphinx
%global cmake_config_args %{cmake_config_args} \\\
-DSPHINX_EXECUTABLE=/usr/bin/sphinx-build-3 \\\
-DSPHINX_OUTPUT_HTML:BOOL=OFF \\\
-DSPHINX_OUTPUT_MAN:BOOL=ON \\\
-DSPHINX_OUTPUT_MAN:BOOL=%{build_docs_toggle} \\\
-DSPHINX_WARNINGS_AS_ERRORS=OFF
#endregion docs options
@ -1649,11 +1695,7 @@ CLANG_LDFLAGS=$(strip_specs "$LDFLAGS $CLANG_LDFLAGS_EXTRA")
%ifarch ppc64le
%global cmake_config_args %{cmake_config_args} -DLLDB_TEST_USER_ARGS=--skip-category=watchpoint
%endif
%if 0%{?rhel} == 8
%global cmake_config_args %{cmake_config_args} -DLLDB_INCLUDE_TESTS:BOOL=OFF
%else
%global cmake_config_args %{cmake_config_args} -DLLDB_ENFORCE_STRICT_TEST_REQUIREMENTS:BOOL=ON
%endif
%global cmake_config_args %{cmake_config_args} -DLLDB_INCLUDE_TESTS:BOOL=OFF
%endif
#endregion lldb options
@ -1715,7 +1757,7 @@ CLANG_LDFLAGS=$(strip_specs "$LDFLAGS $CLANG_LDFLAGS_EXTRA")
#region mlir options
%if %{with mlir}
%global cmake_config_args %{cmake_config_args} \\\
-DMLIR_INCLUDE_DOCS:BOOL=ON \\\
-DMLIR_INCLUDE_DOCS:BOOL=%{build_docs_toggle} \\\
-DMLIR_INCLUDE_TESTS:BOOL=ON \\\
-DMLIR_INCLUDE_INTEGRATION_TESTS:BOOL=OFF \\\
-DMLIR_INSTALL_AGGREGATE_OBJECTS=OFF \\\
@ -1734,11 +1776,17 @@ CLANG_LDFLAGS=$(strip_specs "$LDFLAGS $CLANG_LDFLAGS_EXTRA")
# We reset the cxxflags to "" here because this is compiling for a GPU
# target, where our cflags are either questionable or actively wrong.
%global cmake_config_args %{cmake_config_args} \\\
-DLLVM_RUNTIME_TARGETS='default;amdgcn-amd-amdhsa;nvptx64-nvidia-cuda' \\\
-DRUNTIMES_nvptx64-nvidia-cuda_LLVM_ENABLE_RUNTIMES=openmp \\\
-DRUNTIMES_amdgcn-amd-amdhsa_LLVM_ENABLE_RUNTIMES=openmp \\\
-DRUNTIMES_amdgcn-amd-amdhsa_CMAKE_CXX_FLAGS="" \\\
-DRUNTIMES_nvptx64-nvidia-cuda_CMAKE_CXX_FLAGS=""
-DRUNTIMES_amdgcn-amd-amdhsa_CMAKE_CXX_FLAGS="" \\\
-DRUNTIMES_nvptx64-nvidia-cuda_CMAKE_CXX_FLAGS="" \\\
-DRUNTIMES_amdgcn-amd-amdhsa_CMAKE_EXE_LINKER_FLAGS="" \\\
-DRUNTIMES_nvptx64-nvidia-cuda_CMAKE_EXE_LINKER_FLAGS="" \\\
-DRUNTIMES_amdgcn-amd-amdhsa_CMAKE_SHARED_LINKER_FLAGS="" \\\
-DRUNTIMES_nvptx64-nvidia-cuda_CMAKE_SHARED_LINKER_FLAGS="" \\\
-DRUNTIMES_amdgcn-amd-amdhsa_CMAKE_MODULE_LINKER_FLAGS="" \\\
-DRUNTIMES_nvptx64-nvidia-cuda_CMAKE_MODULE_LINKER_FLAGS="" \\\
-DRUNTIMES_amdgcn-amd-amdhsa_CMAKE_STATIC_LINKER_FLAGS="" \\\
-DRUNTIMES_nvptx64-nvidia-cuda_CMAKE_STATIC_LINKER_FLAGS="" \\\
-DRUNTIMES_amdgcn-amd-amdhsa_LLVM_ENABLE_RUNTIMES="openmp"
%if 0%{?__isa_bits} == 64
# The following shouldn't be required, but due to a bug, we have to be
@ -1761,7 +1809,7 @@ CLANG_LDFLAGS=$(strip_specs "$LDFLAGS $CLANG_LDFLAGS_EXTRA")
#region flang options
%if %{with flang}
%global cmake_config_args %{cmake_config_args} \\\
-DFLANG_INCLUDE_DOCS:BOOL=ON
-DFLANG_INCLUDE_DOCS:BOOL=%{build_docs_toggle}
# Build both, shared and static flang runtime objects.
# See also https://llvm.org/devmtg/2025-04/slides/quick_talk/kruse_flang-rt.pdf
%global cmake_config_args %{cmake_config_args} \\\
@ -1777,12 +1825,31 @@ CLANG_LDFLAGS=$(strip_specs "$LDFLAGS $CLANG_LDFLAGS_EXTRA")
#region libclc options
%if %{with libclc}
# Build SPIR-V targets with the SPIR-V backend.
# Build SPIR-V targets with the SPIR-V backend, reset CXX flags and build libclc
# runtime
%global cmake_config_args %{cmake_config_args} \\\
-DLIBCLC_USE_SPIRV_BACKEND:BOOL=ON
-DRUNTIMES_spirv32-unknown-unknown_LIBCLC_USE_SPIRV_BACKEND:BOOL=ON \\\
-DRUNTIMES_spirv64-unknown-unknown_LIBCLC_USE_SPIRV_BACKEND:BOOL=ON \\\
-DRUNTIMES_spirv32-unknown-unknown_CMAKE_CXX_FLAGS="" \\\
-DRUNTIMES_spirv64-unknown-unknown_CMAKE_CXX_FLAGS="" \\\
-DRUNTIMES_amdgcn-amd-amdhsa-llvm_CMAKE_CXX_FLAGS="" \\\
-DRUNTIMES_spirv32-unknown-unknown_LLVM_ENABLE_RUNTIMES="libclc" \\\
-DRUNTIMES_spirv64-unknown-unknown_LLVM_ENABLE_RUNTIMES="libclc" \\\
-DRUNTIMES_amdgcn-amd-amdhsa-llvm_LLVM_ENABLE_RUNTIMES="libclc"
%endif
#endregion libclc options
%if %{with offload} || %{with libclc}
# For the NVIDIA triple we potentially build both, openmp and libclc
%global combined_runtimes %{?with_offload:openmp%{?with_libclc:;}}%{?with_libclc:libclc}
%global cmake_config_args %{cmake_config_args} \\\
-DRUNTIMES_nvptx64-nvidia-cuda_LLVM_ENABLE_RUNTIMES="%{combined_runtimes}"
%global cmake_config_args %{cmake_config_args} \\\
-DLLVM_RUNTIME_TARGETS="%{runtime_targets}"
%endif
#region test options
%global cmake_config_args %{cmake_config_args} \\\
-DLLVM_BUILD_TESTS:BOOL=ON \\\
@ -2108,7 +2175,9 @@ install %{build_libdir}/libLLVMTestingSupport.a %{buildroot}%{install_libdir}
install %{build_libdir}/libLLVMTestingAnnotations.a %{buildroot}%{install_libdir}
# Fix multi-lib
%if %{with multilib}
%multilib_fix_c_header --file %{install_includedir}/llvm/Config/llvm-config.h
%endif
%if %{without compat_build}
@ -2221,7 +2290,9 @@ ln -s clang-%{maj_ver}.1 %{buildroot}%{install_mandir}/man1/clang++.1
chmod a+x %{buildroot}%{install_datadir}/scan-view/{Reporter.py,startfile.py}
# multilib fix
%if %{with multilib}
%multilib_fix_c_header --file %{install_includedir}/clang/Config/config.h
%endif
# remove editor integrations (bbedit, sublime, emacs, vim)
rm -vf %{buildroot}%{install_datadir}/clang/clang-format-bbedit.applescript
@ -2305,13 +2376,17 @@ rm %{buildroot}%{install_bindir}/llvm-omp-kernel-replay
touch %{buildroot}%{_bindir}/ld
%endif
%if %{build_docs}
install -D -m 644 -t %{buildroot}%{install_mandir}/man1/ lld/docs/ld.lld.1
%endif
#endregion LLD installation
#region LLDB installation
%if %{with lldb}
%if %{with multilib}
%multilib_fix_c_header --file %{install_includedir}/lldb/Host/Config.h
%endif
%if %{without compat_build}
# Move python package out of llvm prefix.
@ -2378,7 +2453,14 @@ rm -v %{buildroot}%{install_libdir}/libFIRAnalysis.a \
%{buildroot}%{install_libdir}/libFIROpenACCTransforms.a \
%{buildroot}%{install_libdir}/libMIFDialect.a
%if %{maj_ver} < 23
find %{buildroot}%{install_includedir}/flang -type f -a ! -iname '*.mod' -delete
%else
# Remove header files that are only needed for writing plugins.
# TODO: Maybe we should package these in the future.
rm -Rf %{buildroot}%{install_includedir}/flang
%endif
# this is a test binary
rm -v %{buildroot}%{install_bindir}/f18-parse-demo
@ -2431,6 +2513,21 @@ move_and_replace_with_symlinks() {
-exec ln -s --relative "$dest/{}" "$src/{}" \;)
}
%if %{build_docs} == 0
# Install the man pages before the symlinks below are created
cp -v ../%{src_manpage_tarball_dir}/* %{buildroot}%{install_mandir}/man1/
%if %{without flang}
rm %{buildroot}%{install_mandir}/man1/flang.1
%endif
%if %{without polly}
rm %{buildroot}%{install_mandir}/man1/polly.1
%endif
%if %{without lldb}
rm %{buildroot}%{install_mandir}/man1/lldb.1
rm %{buildroot}%{install_mandir}/man1/lldb-server.1
%endif
%endif
%if %{without compat_build}
# Move files from the llvm prefix to the system prefix and replace them with
# symlinks. We do it this way around because symlinks between multilib packages
@ -2614,6 +2711,13 @@ reset_test_opts
%cmake_build --target check-lit
#endregion Test LLVM lit
#region Test libclc
%if %{with libclc}
reset_test_opts
%cmake_build --target check-libclc
%endif
#endregion Test libclc
#region Test LLVM
reset_test_opts
# Xfail testing of update utility tools
@ -3189,6 +3293,7 @@ fi
%if %{maj_ver} >= 23
%{expand_bins %{expand:
llubi
llvm-extract-bundle-entry
llvm-gpu-loader
}}
%else
@ -3259,6 +3364,7 @@ fi
%if %{maj_ver} >= 23
%{expand_mans %{expand:
llubi
llvm-extract-bundle-entry
}}
%else
%{expand_mans %{expand:
@ -3369,12 +3475,6 @@ fi
}}
%{install_bindir}/clang-%{maj_ver}
%{_sysconfdir}/%{pkg_name_clang}/%{_target_platform}-clang.cfg
%{_sysconfdir}/%{pkg_name_clang}/%{_target_platform}-clang++.cfg
%ifarch x86_64
%{_sysconfdir}/%{pkg_name_clang}/i386-redhat-linux-gnu-clang.cfg
%{_sysconfdir}/%{pkg_name_clang}/i386-redhat-linux-gnu-clang++.cfg
%endif
%{expand_mans clang clang++}
%if 0%{with pgo}
@ -3401,6 +3501,13 @@ fi
%{_libdir}/libclang-cpp.so.%{compat_maj_ver}*
%endif
%{_sysconfdir}/%{pkg_name_clang}/%{_target_platform}-clang.cfg
%{_sysconfdir}/%{pkg_name_clang}/%{_target_platform}-clang++.cfg
%ifarch x86_64
%{_sysconfdir}/%{pkg_name_clang}/i386-redhat-linux-gnu-clang.cfg
%{_sysconfdir}/%{pkg_name_clang}/i386-redhat-linux-gnu-clang++.cfg
%endif
%files -n %{pkg_name_clang}-devel
%license clang/LICENSE.TXT
%{expand_libs %{expand:
@ -3488,6 +3595,7 @@ fi
%if %{maj_ver} >= 23
%{expand_bins %{expand:
clang-ssaf-analyzer
clang-ssaf-format
clang-ssaf-linker
}}
@ -3742,9 +3850,15 @@ fi
flang-new
}}
%{install_bindir}/flang-%{maj_ver}
%if %{maj_ver} < 23
%{expand_includes %{expand:
flang/*.mod
}}
%else
%{_prefix}/lib/clang/%{maj_ver}/finclude/flang/%{llvm_triple}/*.mod
%{_prefix}/lib/clang/%{maj_ver}/finclude/flang/%{llvm_triple}/omp_lib.h
%endif
%{_sysconfdir}/%{pkg_name_clang}/%{_target_platform}-flang.cfg
%ifarch x86_64
@ -3767,17 +3881,17 @@ fi
%license libclc/LICENSE.TXT
%doc libclc/README.md libclc/CREDITS.TXT
%{_prefix}/lib/clang/%{maj_ver}/lib/amdgcn-amd-amdhsa-llvm/libclc.bc
%{_prefix}/lib/clang/%{maj_ver}/lib/nvptx64--/libclc.bc
%{_prefix}/lib/clang/%{maj_ver}/lib/nvptx64--nvidiacl/libclc.bc
%{_prefix}/lib/clang/%{maj_ver}/lib/amdgcn-amd-amdhsa-llvm/libclc.a
%{_prefix}/lib/clang/%{maj_ver}/lib/nvptx64-nvidia-cuda/libclc.bc
%{_prefix}/lib/clang/%{maj_ver}/lib/spir--/libclc.bc
%{_prefix}/lib/clang/%{maj_ver}/lib/spir64--/libclc.bc
%{_prefix}/lib/clang/%{maj_ver}/lib/nvptx64-nvidia-cuda/libclc.a
%files -n %{pkg_name_libclc}-spirv
%license libclc/LICENSE.TXT
%doc libclc/README.md libclc/CREDITS.TXT
%{_prefix}/lib/clang/%{maj_ver}/lib/spirv32--/libclc.spv
%{_prefix}/lib/clang/%{maj_ver}/lib/spirv64--/libclc.spv
%{_prefix}/lib/clang/%{maj_ver}/lib/spirv32-unknown-unknown/libclc.spv
%{_prefix}/lib/clang/%{maj_ver}/lib/spirv32-unknown-unknown/libclc.a
%{_prefix}/lib/clang/%{maj_ver}/lib/spirv64-unknown-unknown/libclc.spv
%{_prefix}/lib/clang/%{maj_ver}/lib/spirv64-unknown-unknown/libclc.a
%endif
#endregion libclc files

View File

@ -1,4 +1,2 @@
SHA512 (llvm-project-22.1.3.src.tar.xz) = 3557a955d55471671ae2f7b9c809affd59a29a6fb1e70a2a5d040dc1c6376246deb0635be8ca36cae09112981760e9afb128c822e5554bd722589fb8dee3f0df
SHA512 (llvm-project-22.1.3.src.tar.xz.sig) = 153a0d174492a0facd061b5cfa3e18dbf946cc0c7d1fb50f4d961410d41cea1f355515fd3e892be676b8b34d61a21962c48acb90aa5d310d05cf6452053e52ad
SHA512 (llvm-project-21.1.8.src.tar.xz) = cae4c44e7bf678071723da63ad5839491d717a7233e7f4791aa408207f3ea42f52de939ad15189b112c02a0770f1bb8d59bae6ad31ef53417a6eea7770fe52ab
SHA512 (llvm-project-21.1.8.src.tar.xz.sig) = 10f58eff58ed6e701d0f123b15e68c82ab8cbdf99b1c86c0d83e3b8553e90ea51055e30327e8e442ded57c8f503e2a2de9ee075e9c28b5ba815a0f8922f8671c
SHA512 (llvm-project-22.1.8.src.tar.xz) = 2615b20ba08534f83ab8ecc7b5ba43b5f1dfcf9cdb2534a32fcdbf0ccdd9a008b46276e45ef26ed9377f65b5e4ae89ea798f3863fd034484b5715140f3a7b35c
SHA512 (llvm-project-22.1.8.src.tar.xz.sig) = 99a457b5b1fb409a5fe72b59ebd4ddae5cade3e5f2493e33b44d4f4b4625f7a1743f80106efb1134668842b15ea3400ce2c29263bec8ff986e05040910125e15