From 7a1f5e88aec7971ebb4fa1a4c9798cd12fe68e6f Mon Sep 17 00:00:00 2001 From: AlmaLinux RelEng Bot Date: Wed, 13 May 2026 15:39:36 -0400 Subject: [PATCH] import UBI llvm-21.1.8-1.module+el8.10.0+23969+c061985f --- .gitignore | 4 +- .llvm.metadata | 4 +- ...-18-Always-build-shared-libs-for-LLD.patch | 29 - SOURCES/0001-20-polly-shared-libs.patch | 59 + SOURCES/0001-22-polly-shared-libs.patch | 59 + ...erts-to-test-added-in-145149-because.patch | 26 + .../0001-BPF-Support-Jump-Table-149715.patch | 1354 +++++++ ...Base-Scaled-Reg-does-not-dominate-in.patch | 131 + ...ake-sure-instruction-get-from-SunkAd.patch | 143 + ...k-for-cast-when-shufflevector-172443.patch | 137 + ...ling-of-undefs-in-the-PPC-isSplatShu.patch | 67 + ...-in-widening-vector-multiplication-1.patch | 191 + ...-to-fix-the-offload-build-with-the-m.patch | 27 + ...-symlink-when-finding-install-prefix.patch | 39 + ...essed-debug-level-test-for-s390x-wit.patch | 29 + ...-option-to-disable-tsan-tests-111548.patch | 62 - ...siblings_list-if-physical_package_id.patch | 205 -- ...-vaddr-for-__llvm_write_binary_ids-n.patch | 86 - ...unused-weak-symbol-__bpf_trap-166003.patch | 130 + ...code-related-to-__bpf_trap-global-va.patch | 34 + SOURCES/18-99273.patch | 893 ----- SOURCES/20-131099.patch | 28 + SOURCES/21-146424.patch | 94 + ...4631c1f42dbfce78288b8ae30b5840ed59b3.patch | 276 ++ SOURCES/changelog | 1013 ++++++ SOURCES/release-keys.asc | 26 + SPECS/llvm.spec | 3187 +++++++++++------ 27 files changed, 5914 insertions(+), 2419 deletions(-) delete mode 100644 SOURCES/0001-18-Always-build-shared-libs-for-LLD.patch create mode 100644 SOURCES/0001-20-polly-shared-libs.patch create mode 100644 SOURCES/0001-22-polly-shared-libs.patch create mode 100644 SOURCES/0001-Add-REQUIRES-asserts-to-test-added-in-145149-because.patch create mode 100644 SOURCES/0001-BPF-Support-Jump-Table-149715.patch create mode 100644 SOURCES/0001-CGP-Bail-out-if-Base-Scaled-Reg-does-not-dominate-in.patch create mode 100644 SOURCES/0001-CodeGenPrepare-Make-sure-instruction-get-from-SunkAd.patch create mode 100644 SOURCES/0001-PowerPC-Add-check-for-cast-when-shufflevector-172443.patch create mode 100644 SOURCES/0001-PowerPC-Fix-handling-of-undefs-in-the-PPC-isSplatShu.patch create mode 100644 SOURCES/0001-SystemZ-Fix-code-in-widening-vector-multiplication-1.patch create mode 100644 SOURCES/0001-clang-Add-a-hack-to-fix-the-offload-build-with-the-m.patch create mode 100644 SOURCES/0001-cmake-Resolve-symlink-when-finding-install-prefix.patch create mode 100644 SOURCES/0001-lld-Adjust-compressed-debug-level-test-for-s390x-wit.patch delete mode 100644 SOURCES/0001-openmp-Add-option-to-disable-tsan-tests-111548.patch delete mode 100644 SOURCES/0001-openmp-Use-core_siblings_list-if-physical_package_id.patch delete mode 100644 SOURCES/0001-profile-Use-base-vaddr-for-__llvm_write_binary_ids-n.patch create mode 100644 SOURCES/0002-BPF-Remove-unused-weak-symbol-__bpf_trap-166003.patch create mode 100644 SOURCES/0003-BPF-Remove-dead-code-related-to-__bpf_trap-global-va.patch delete mode 100644 SOURCES/18-99273.patch create mode 100644 SOURCES/20-131099.patch create mode 100644 SOURCES/21-146424.patch create mode 100644 SOURCES/43cb4631c1f42dbfce78288b8ae30b5840ed59b3.patch create mode 100644 SOURCES/changelog diff --git a/.gitignore b/.gitignore index d5af39e..ac8f1f6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -SOURCES/llvm-project-19.1.7.src.tar.xz -SOURCES/llvm-project-19.1.7.src.tar.xz.sig +SOURCES/llvm-project-21.1.8.src.tar.xz +SOURCES/llvm-project-21.1.8.src.tar.xz.sig diff --git a/.llvm.metadata b/.llvm.metadata index 052919e..7bae3ec 100644 --- a/.llvm.metadata +++ b/.llvm.metadata @@ -1,2 +1,2 @@ -6e4033d8b76a89e82220b5445bff58cdce64300e SOURCES/llvm-project-19.1.7.src.tar.xz -48f839c6e47a34a1138862a9db6274c150179532 SOURCES/llvm-project-19.1.7.src.tar.xz.sig +a02f43a68bf59be15a61d6ddd0d99bd4973244f4 SOURCES/llvm-project-21.1.8.src.tar.xz +c10b9d8ebce251f8be51eb71378122300fd37de3 SOURCES/llvm-project-21.1.8.src.tar.xz.sig diff --git a/SOURCES/0001-18-Always-build-shared-libs-for-LLD.patch b/SOURCES/0001-18-Always-build-shared-libs-for-LLD.patch deleted file mode 100644 index 1659800..0000000 --- a/SOURCES/0001-18-Always-build-shared-libs-for-LLD.patch +++ /dev/null @@ -1,29 +0,0 @@ -From b1c60d7fa322a2d208556087df9e7ef94bfbffb8 Mon Sep 17 00:00:00 2001 -From: Nikita Popov -Date: Wed, 8 May 2024 12:30:36 +0900 -Subject: [PATCH] Always build shared libs for LLD - -We don't want to enable BUILD_SHARED_LIBS for the whole build, -but we do want to build lld libraries. ---- - lld/cmake/modules/AddLLD.cmake | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/lld/cmake/modules/AddLLD.cmake b/lld/cmake/modules/AddLLD.cmake -index 2ee066b41535..270c03f096ac 100644 ---- a/lld/cmake/modules/AddLLD.cmake -+++ b/lld/cmake/modules/AddLLD.cmake -@@ -7,9 +7,8 @@ macro(add_lld_library name) - "" - "" - ${ARGN}) -- if(ARG_SHARED) -- set(ARG_ENABLE_SHARED SHARED) -- endif() -+ # Always build shared libs for LLD. -+ set(ARG_ENABLE_SHARED SHARED) - llvm_add_library(${name} ${ARG_ENABLE_SHARED} ${ARG_UNPARSED_ARGUMENTS}) - set_target_properties(${name} PROPERTIES FOLDER "lld libraries") - --- -2.44.0 \ No newline at end of file diff --git a/SOURCES/0001-20-polly-shared-libs.patch b/SOURCES/0001-20-polly-shared-libs.patch new file mode 100644 index 0000000..b0c90da --- /dev/null +++ b/SOURCES/0001-20-polly-shared-libs.patch @@ -0,0 +1,59 @@ +From cecb98f56e7d6619d0427fbdbc2f200ce212f0c6 Mon Sep 17 00:00:00 2001 +From: Konrad Kleine +Date: Tue, 28 Jan 2025 08:34:09 +0000 +Subject: [PATCH] [polly] shared libs + +--- + polly/cmake/polly_macros.cmake | 5 ++++- + polly/lib/CMakeLists.txt | 1 + + polly/lib/External/CMakeLists.txt | 1 + + 3 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/polly/cmake/polly_macros.cmake b/polly/cmake/polly_macros.cmake +index 9bd7b0b0ea59..fc2c3a76901f 100644 +--- a/polly/cmake/polly_macros.cmake ++++ b/polly/cmake/polly_macros.cmake +@@ -1,5 +1,5 @@ + macro(add_polly_library name) +- cmake_parse_arguments(ARG "" "" "" ${ARGN}) ++ cmake_parse_arguments(ARG "SHARED" "" "" ${ARGN}) + set(srcs ${ARG_UNPARSED_ARGUMENTS}) + if(MSVC_IDE OR XCODE) + file( GLOB_RECURSE headers *.h *.td *.def) +@@ -17,6 +17,9 @@ macro(add_polly_library name) + else() + set(libkind) + endif() ++ if (ARG_SHARED) ++ set(libkind SHARED) ++ endif() + add_library( ${name} ${libkind} ${srcs} ) + set_target_properties(${name} PROPERTIES FOLDER "Polly/Libraries") + +diff --git a/polly/lib/CMakeLists.txt b/polly/lib/CMakeLists.txt +index d91f4ecd37e6..965f635b7ff6 100644 +--- a/polly/lib/CMakeLists.txt ++++ b/polly/lib/CMakeLists.txt +@@ -41,6 +41,7 @@ set(POLLY_COMPONENTS + # the sources them to be recompiled for each of them. + add_llvm_pass_plugin(Polly + NO_MODULE ++ SHARED + SUBPROJECT Polly + Analysis/DependenceInfo.cpp + Analysis/PolyhedralInfo.cpp +diff --git a/polly/lib/External/CMakeLists.txt b/polly/lib/External/CMakeLists.txt +index 5dd69b7199dc..f065fbd7b942 100644 +--- a/polly/lib/External/CMakeLists.txt ++++ b/polly/lib/External/CMakeLists.txt +@@ -284,6 +284,7 @@ if (POLLY_BUNDLED_ISL) + ) + + add_polly_library(PollyISL ++ SHARED + ${ISL_FILES} + ) + +-- +2.46.0 + diff --git a/SOURCES/0001-22-polly-shared-libs.patch b/SOURCES/0001-22-polly-shared-libs.patch new file mode 100644 index 0000000..091db35 --- /dev/null +++ b/SOURCES/0001-22-polly-shared-libs.patch @@ -0,0 +1,59 @@ +From daf5077c8ce848b39239879369679c9fea7041b1 Mon Sep 17 00:00:00 2001 +From: Konrad Kleine +Date: Tue, 28 Jan 2025 08:34:09 +0000 +Subject: [PATCH] shared libs + +--- + polly/cmake/polly_macros.cmake | 5 ++++- + polly/lib/CMakeLists.txt | 1 + + polly/lib/External/CMakeLists.txt | 1 + + 3 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/polly/cmake/polly_macros.cmake b/polly/cmake/polly_macros.cmake +index 9bd7b0b0ea59..fc2c3a76901f 100644 +--- a/polly/cmake/polly_macros.cmake ++++ b/polly/cmake/polly_macros.cmake +@@ -1,5 +1,5 @@ + macro(add_polly_library name) +- cmake_parse_arguments(ARG "" "" "" ${ARGN}) ++ cmake_parse_arguments(ARG "SHARED" "" "" ${ARGN}) + set(srcs ${ARG_UNPARSED_ARGUMENTS}) + if(MSVC_IDE OR XCODE) + file( GLOB_RECURSE headers *.h *.td *.def) +@@ -17,6 +17,9 @@ macro(add_polly_library name) + else() + set(libkind) + endif() ++ if (ARG_SHARED) ++ set(libkind SHARED) ++ endif() + add_library( ${name} ${libkind} ${srcs} ) + set_target_properties(${name} PROPERTIES FOLDER "Polly/Libraries") + +diff --git a/polly/lib/CMakeLists.txt b/polly/lib/CMakeLists.txt +index 0ed673815ff3..e156dcb31655 100644 +--- a/polly/lib/CMakeLists.txt ++++ b/polly/lib/CMakeLists.txt +@@ -41,6 +41,7 @@ set(POLLY_COMPONENTS + # the sources them to be recompiled for each of them. + add_llvm_pass_plugin(Polly + NO_MODULE ++ SHARED + SUBPROJECT Polly + Analysis/DependenceInfo.cpp + Analysis/ScopDetection.cpp +diff --git a/polly/lib/External/CMakeLists.txt b/polly/lib/External/CMakeLists.txt +index ab5cba93cdcf..fdfd06864bc7 100644 +--- a/polly/lib/External/CMakeLists.txt ++++ b/polly/lib/External/CMakeLists.txt +@@ -284,6 +284,7 @@ if (POLLY_BUNDLED_ISL) + ) + + add_polly_library(PollyISL ++ SHARED + ${ISL_FILES} + ) + +-- +2.50.1 + diff --git a/SOURCES/0001-Add-REQUIRES-asserts-to-test-added-in-145149-because.patch b/SOURCES/0001-Add-REQUIRES-asserts-to-test-added-in-145149-because.patch new file mode 100644 index 0000000..26f372c --- /dev/null +++ b/SOURCES/0001-Add-REQUIRES-asserts-to-test-added-in-145149-because.patch @@ -0,0 +1,26 @@ +From ffc7d5ae2d79f98967943fabb2abfbc1b1e047fd Mon Sep 17 00:00:00 2001 +From: Douglas Yung +Date: Tue, 24 Jun 2025 04:08:34 +0000 +Subject: [PATCH] Add `REQUIRES: asserts` to test added in #145149 because it + uses the `-debug-only=` flag. + +This should fix the test failure when building without asserts. +--- + llvm/test/CodeGen/PowerPC/pr141642.ll | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/llvm/test/CodeGen/PowerPC/pr141642.ll b/llvm/test/CodeGen/PowerPC/pr141642.ll +index 38a706574786..61bda4dfaf53 100644 +--- a/llvm/test/CodeGen/PowerPC/pr141642.ll ++++ b/llvm/test/CodeGen/PowerPC/pr141642.ll +@@ -2,6 +2,7 @@ + ; RUN: FileCheck %s + ; CHECK-NOT: lxvdsx + ; CHECK-NOT: LD_SPLAT ++; REQUIRES: asserts + + define weak_odr dso_local void @unpack(ptr noalias noundef %packed_in) local_unnamed_addr { + entry: +-- +2.49.0 + diff --git a/SOURCES/0001-BPF-Support-Jump-Table-149715.patch b/SOURCES/0001-BPF-Support-Jump-Table-149715.patch new file mode 100644 index 0000000..c1cbc12 --- /dev/null +++ b/SOURCES/0001-BPF-Support-Jump-Table-149715.patch @@ -0,0 +1,1354 @@ +From 528baf4740aed86443e3041eb3b6044963f96e1a Mon Sep 17 00:00:00 2001 +From: yonghong-song +Date: Tue, 16 Sep 2025 09:27:08 -0700 +Subject: [PATCH] [BPF] Support Jump Table (#149715) + +Add jump table (switch statement and computed goto) support for BPF +backend. +A `gotox ` insn is implemented and the `` holds the target +insn where the gotox will go. + +For a switch statement like +``` +... + switch (ctx->x) { + case 1: ret_user = 18; break; + case 20: ret_user = 6; break; + case 16: ret_user = 9; break; + case 6: ret_user = 16; break; + case 8: ret_user = 14; break; + case 30: ret_user = 2; break; + default: ret_user = 1; break; + } +... +``` +and the final binary +``` + The final binary: + 4: 67 01 00 00 03 00 00 00 r1 <<= 0x3 + 5: 18 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 r2 = 0x0 ll + 0000000000000028: R_BPF_64_64 BPF.JT.0.0 + 7: 0f 12 00 00 00 00 00 00 r2 += r1 + ... + Symbol table: + 4: 0000000000000000 240 OBJECT GLOBAL DEFAULT 4 BPF.JT.0.0 + 5: 0000000000000000 4 OBJECT GLOBAL DEFAULT 6 ret_user + 6: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND bar + 7: 00000000000000f0 256 OBJECT GLOBAL DEFAULT 4 BPF.JT.0.1 + and + [ 4] .jumptables PROGBITS 0000000000000000 0001c8 0001f0 00 0 0 1 +``` +Note that for the above example, `-mllvm -bpf-min-jump-table-entries=5` +should be in compilation flags as the current default +bpf-min-jump-table-entries is 13. For example. +``` +clang --target=bpf -mcpu=v4 -O2 -mllvm -bpf-min-jump-table-entries=5 -S -g test.c +``` + +For computed goto like +``` + int foo(int a, int b) { + __label__ l1, l2, l3, l4; + void *jt1[] = {[0]=&&l1, [1]=&&l2}; + void *jt2[] = {[0]=&&l3, [1]=&&l4}; + int ret = 0; + + goto *jt1[a % 2]; + l1: ret += 1; + l2: ret += 3; + goto *jt2[b % 2]; + l3: ret += 5; + l4: ret += 7; + return ret; + } +``` +The final binary: +``` + 12: bf 23 20 00 00 00 00 00 r3 = (s32)r2 + 13: 67 03 00 00 03 00 00 00 r3 <<= 0x3 + 14: 18 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 r2 = 0x0 ll + 0000000000000070: R_BPF_64_64 BPF.JT.0.0 + 16: 0f 32 00 00 00 00 00 00 r2 += r3 + 17: bf 11 20 00 00 00 00 00 r1 = (s32)r1 + 18: 67 01 00 00 03 00 00 00 r1 <<= 0x3 + 19: 18 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 r3 = 0x0 ll + 0000000000000098: R_BPF_64_64 BPF.JT.0.1 + 21: 0f 13 00 00 00 00 00 00 r3 += r1 + + [ 4] .jumptables PROGBITS 0000000000000000 000160 000020 00 0 0 1 + + 4: 0000000000000000 16 OBJECT GLOBAL DEFAULT 4 BPF.JT.0.0 + 5: 0000000000000010 16 OBJECT GLOBAL DEFAULT 4 BPF.JT.0.1 +``` + +A more complicated test with both switch-statement triggered jump table +and compute gotos: + +``` +$ cat test3.c +struct simple_ctx { + int x; + int y; + int z; +}; + +int ret_user, ret_user2; +void bar(void); +int foo(struct simple_ctx *ctx, struct simple_ctx *ctx2, int a, int b) +{ + __label__ l1, l2, l3, l4; + void *jt1[] = {[0]=&&l1, [1]=&&l2}; + void *jt2[] = {[0]=&&l3, [1]=&&l4}; + int ret = 0; + + goto *jt1[a % 2]; + l1: ret += 1; + l2: ret += 3; + goto *jt2[b % 2]; + l3: ret += 5; + l4: ret += 7; + + bar(); + + switch (ctx->x) { + case 1: ret_user = 18; break; + case 20: ret_user = 6; break; + case 16: ret_user = 9; break; + case 6: ret_user = 16; break; + case 8: ret_user = 14; break; + case 30: ret_user = 2; break; + default: ret_user = 1; break; + } + + return ret; +} +``` +Compile with +``` + clang --target=bpf -mcpu=v4 -O2 -S test3.c + clang --target=bpf -mcpu=v4 -O2 -c test3.c +``` + The binary: +``` + /* For computed goto */ + 13: bf 42 20 00 00 00 00 00 r2 = (s32)r4 + 14: 67 02 00 00 03 00 00 00 r2 <<= 0x3 + 15: 18 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 r1 = 0x0 ll + 0000000000000078: R_BPF_64_64 BPF.JT.0.1 + 17: 0f 21 00 00 00 00 00 00 r1 += r2 + 18: bf 32 20 00 00 00 00 00 r2 = (s32)r3 + 19: 67 02 00 00 03 00 00 00 r2 <<= 0x3 + 20: 18 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 r3 = 0x0 ll + 00000000000000a0: R_BPF_64_64 BPF.JT.0.2 + 22: 0f 23 00 00 00 00 00 00 r3 += r2 + + /* For switch statement */ + 39: 67 01 00 00 03 00 00 00 r1 <<= 0x3 + 40: 18 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 r2 = 0x0 ll + 0000000000000140: R_BPF_64_64 BPF.JT.0.0 + 42: 0f 12 00 00 00 00 00 00 r2 += r1 +``` +You can see jump table symbols are all different. + +(cherry picked from commit c3fb2e1cee954338acb83955b157e0a2e82a4849) +--- + .../lib/Target/BPF/AsmParser/BPFAsmParser.cpp | 1 + + llvm/lib/Target/BPF/BPFAsmPrinter.cpp | 114 +++++++++++--- + llvm/lib/Target/BPF/BPFAsmPrinter.h | 48 ++++++ + llvm/lib/Target/BPF/BPFISelLowering.cpp | 143 +++++++++++++++++- + llvm/lib/Target/BPF/BPFISelLowering.h | 8 +- + llvm/lib/Target/BPF/BPFInstrInfo.cpp | 45 ++++++ + llvm/lib/Target/BPF/BPFInstrInfo.h | 3 + + llvm/lib/Target/BPF/BPFInstrInfo.td | 26 +++- + llvm/lib/Target/BPF/BPFMCInstLower.cpp | 6 + + llvm/lib/Target/BPF/BPFMCInstLower.h | 6 +- + llvm/lib/Target/BPF/BPFSubtarget.cpp | 4 + + llvm/lib/Target/BPF/BPFSubtarget.h | 3 +- + .../BPF/BPFTargetLoweringObjectFile.cpp | 19 +++ + .../Target/BPF/BPFTargetLoweringObjectFile.h | 25 +++ + llvm/lib/Target/BPF/BPFTargetMachine.cpp | 3 +- + llvm/lib/Target/BPF/CMakeLists.txt | 1 + + llvm/test/CodeGen/BPF/jump_table_blockaddr.ll | 91 +++++++++++ + .../test/CodeGen/BPF/jump_table_global_var.ll | 83 ++++++++++ + .../CodeGen/BPF/jump_table_switch_stmt.ll | 126 +++++++++++++++ + 19 files changed, 716 insertions(+), 39 deletions(-) + create mode 100644 llvm/lib/Target/BPF/BPFAsmPrinter.h + create mode 100644 llvm/lib/Target/BPF/BPFTargetLoweringObjectFile.cpp + create mode 100644 llvm/lib/Target/BPF/BPFTargetLoweringObjectFile.h + create mode 100644 llvm/test/CodeGen/BPF/jump_table_blockaddr.ll + create mode 100644 llvm/test/CodeGen/BPF/jump_table_global_var.ll + create mode 100644 llvm/test/CodeGen/BPF/jump_table_switch_stmt.ll + +diff --git a/llvm/lib/Target/BPF/AsmParser/BPFAsmParser.cpp b/llvm/lib/Target/BPF/AsmParser/BPFAsmParser.cpp +index a347794a9a30..d96f403d2f81 100644 +--- a/llvm/lib/Target/BPF/AsmParser/BPFAsmParser.cpp ++++ b/llvm/lib/Target/BPF/AsmParser/BPFAsmParser.cpp +@@ -234,6 +234,7 @@ public: + .Case("callx", true) + .Case("goto", true) + .Case("gotol", true) ++ .Case("gotox", true) + .Case("may_goto", true) + .Case("*", true) + .Case("exit", true) +diff --git a/llvm/lib/Target/BPF/BPFAsmPrinter.cpp b/llvm/lib/Target/BPF/BPFAsmPrinter.cpp +index e3843e0e112e..77dc4a75a7d6 100644 +--- a/llvm/lib/Target/BPF/BPFAsmPrinter.cpp ++++ b/llvm/lib/Target/BPF/BPFAsmPrinter.cpp +@@ -11,52 +11,35 @@ + // + //===----------------------------------------------------------------------===// + ++#include "BPFAsmPrinter.h" + #include "BPF.h" + #include "BPFInstrInfo.h" + #include "BPFMCInstLower.h" + #include "BTFDebug.h" + #include "MCTargetDesc/BPFInstPrinter.h" + #include "TargetInfo/BPFTargetInfo.h" ++#include "llvm/BinaryFormat/ELF.h" + #include "llvm/CodeGen/AsmPrinter.h" + #include "llvm/CodeGen/MachineConstantPool.h" + #include "llvm/CodeGen/MachineInstr.h" ++#include "llvm/CodeGen/MachineJumpTableInfo.h" + #include "llvm/CodeGen/MachineModuleInfo.h" ++#include "llvm/CodeGen/TargetLowering.h" + #include "llvm/IR/Module.h" + #include "llvm/MC/MCAsmInfo.h" ++#include "llvm/MC/MCExpr.h" + #include "llvm/MC/MCInst.h" + #include "llvm/MC/MCStreamer.h" + #include "llvm/MC/MCSymbol.h" ++#include "llvm/MC/MCSymbolELF.h" + #include "llvm/MC/TargetRegistry.h" + #include "llvm/Support/Compiler.h" + #include "llvm/Support/raw_ostream.h" ++#include "llvm/Target/TargetLoweringObjectFile.h" + using namespace llvm; + + #define DEBUG_TYPE "asm-printer" + +-namespace { +-class BPFAsmPrinter : public AsmPrinter { +-public: +- explicit BPFAsmPrinter(TargetMachine &TM, +- std::unique_ptr Streamer) +- : AsmPrinter(TM, std::move(Streamer), ID), BTF(nullptr) {} +- +- StringRef getPassName() const override { return "BPF Assembly Printer"; } +- bool doInitialization(Module &M) override; +- void printOperand(const MachineInstr *MI, int OpNum, raw_ostream &O); +- bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, +- const char *ExtraCode, raw_ostream &O) override; +- bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum, +- const char *ExtraCode, raw_ostream &O) override; +- +- void emitInstruction(const MachineInstr *MI) override; +- +- static char ID; +- +-private: +- BTFDebug *BTF; +-}; +-} // namespace +- + bool BPFAsmPrinter::doInitialization(Module &M) { + AsmPrinter::doInitialization(M); + +@@ -69,6 +52,45 @@ bool BPFAsmPrinter::doInitialization(Module &M) { + return false; + } + ++const BPFTargetMachine &BPFAsmPrinter::getBTM() const { ++ return static_cast(TM); ++} ++ ++bool BPFAsmPrinter::doFinalization(Module &M) { ++ // Remove unused globals which are previously used for jump table. ++ const BPFSubtarget *Subtarget = getBTM().getSubtargetImpl(); ++ if (Subtarget->hasGotox()) { ++ std::vector Targets; ++ for (GlobalVariable &Global : M.globals()) { ++ if (Global.getLinkage() != GlobalValue::PrivateLinkage) ++ continue; ++ if (!Global.isConstant() || !Global.hasInitializer()) ++ continue; ++ ++ Constant *CV = dyn_cast(Global.getInitializer()); ++ if (!CV) ++ continue; ++ ConstantArray *CA = dyn_cast(CV); ++ if (!CA) ++ continue; ++ ++ for (unsigned i = 1, e = CA->getNumOperands(); i != e; ++i) { ++ if (!dyn_cast(CA->getOperand(i))) ++ continue; ++ } ++ Targets.push_back(&Global); ++ } ++ ++ for (GlobalVariable *GV : Targets) { ++ GV->replaceAllUsesWith(PoisonValue::get(GV->getType())); ++ GV->dropAllReferences(); ++ GV->eraseFromParent(); ++ } ++ } ++ ++ return AsmPrinter::doFinalization(M); ++} ++ + void BPFAsmPrinter::printOperand(const MachineInstr *MI, int OpNum, + raw_ostream &O) { + const MachineOperand &MO = MI->getOperand(OpNum); +@@ -150,6 +172,50 @@ void BPFAsmPrinter::emitInstruction(const MachineInstr *MI) { + EmitToStreamer(*OutStreamer, TmpInst); + } + ++MCSymbol *BPFAsmPrinter::getJTPublicSymbol(unsigned JTI) { ++ SmallString<60> Name; ++ raw_svector_ostream(Name) ++ << "BPF.JT." << MF->getFunctionNumber() << '.' << JTI; ++ MCSymbol *S = OutContext.getOrCreateSymbol(Name); ++ if (auto *ES = static_cast(S)) { ++ ES->setBinding(ELF::STB_GLOBAL); ++ ES->setType(ELF::STT_OBJECT); ++ } ++ return S; ++} ++ ++void BPFAsmPrinter::emitJumpTableInfo() { ++ const MachineJumpTableInfo *MJTI = MF->getJumpTableInfo(); ++ if (!MJTI) ++ return; ++ ++ const std::vector &JT = MJTI->getJumpTables(); ++ if (JT.empty()) ++ return; ++ ++ const TargetLoweringObjectFile &TLOF = getObjFileLowering(); ++ const Function &F = MF->getFunction(); ++ MCSection *JTS = TLOF.getSectionForJumpTable(F, TM); ++ assert(MJTI->getEntryKind() == MachineJumpTableInfo::EK_BlockAddress); ++ unsigned EntrySize = MJTI->getEntrySize(getDataLayout()); ++ OutStreamer->switchSection(JTS); ++ for (unsigned JTI = 0; JTI < JT.size(); JTI++) { ++ ArrayRef JTBBs = JT[JTI].MBBs; ++ if (JTBBs.empty()) ++ continue; ++ ++ MCSymbol *JTStart = getJTPublicSymbol(JTI); ++ OutStreamer->emitLabel(JTStart); ++ for (const MachineBasicBlock *MBB : JTBBs) { ++ const MCExpr *LHS = MCSymbolRefExpr::create(MBB->getSymbol(), OutContext); ++ OutStreamer->emitValue(LHS, EntrySize); ++ } ++ const MCExpr *JTSize = ++ MCConstantExpr::create(JTBBs.size() * EntrySize, OutContext); ++ OutStreamer->emitELFSize(JTStart, JTSize); ++ } ++} ++ + char BPFAsmPrinter::ID = 0; + + INITIALIZE_PASS(BPFAsmPrinter, "bpf-asm-printer", "BPF Assembly Printer", false, +diff --git a/llvm/lib/Target/BPF/BPFAsmPrinter.h b/llvm/lib/Target/BPF/BPFAsmPrinter.h +new file mode 100644 +index 000000000000..0cfb2839c8ff +--- /dev/null ++++ b/llvm/lib/Target/BPF/BPFAsmPrinter.h +@@ -0,0 +1,48 @@ ++//===-- BPFFrameLowering.h - Define frame lowering for BPF -----*- C++ -*--===// ++// ++// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. ++// See https://llvm.org/LICENSE.txt for license information. ++// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ++// ++//===----------------------------------------------------------------------===// ++ ++#ifndef LLVM_LIB_TARGET_BPF_BPFASMPRINTER_H ++#define LLVM_LIB_TARGET_BPF_BPFASMPRINTER_H ++ ++#include "BPFTargetMachine.h" ++#include "BTFDebug.h" ++#include "llvm/CodeGen/AsmPrinter.h" ++ ++namespace llvm { ++ ++class BPFAsmPrinter : public AsmPrinter { ++public: ++ explicit BPFAsmPrinter(TargetMachine &TM, ++ std::unique_ptr Streamer) ++ : AsmPrinter(TM, std::move(Streamer), ID), BTF(nullptr), TM(TM) {} ++ ++ StringRef getPassName() const override { return "BPF Assembly Printer"; } ++ bool doInitialization(Module &M) override; ++ bool doFinalization(Module &M) override; ++ void printOperand(const MachineInstr *MI, int OpNum, raw_ostream &O); ++ bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, ++ const char *ExtraCode, raw_ostream &O) override; ++ bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNum, ++ const char *ExtraCode, raw_ostream &O) override; ++ ++ void emitInstruction(const MachineInstr *MI) override; ++ MCSymbol *getJTPublicSymbol(unsigned JTI); ++ virtual void emitJumpTableInfo() override; ++ ++ static char ID; ++ ++private: ++ BTFDebug *BTF; ++ TargetMachine &TM; ++ ++ const BPFTargetMachine &getBTM() const; ++}; ++ ++} // namespace llvm ++ ++#endif /* LLVM_LIB_TARGET_BPF_BPFASMPRINTER_H */ +diff --git a/llvm/lib/Target/BPF/BPFISelLowering.cpp b/llvm/lib/Target/BPF/BPFISelLowering.cpp +index f4f414d192df..6e5520c3dbb1 100644 +--- a/llvm/lib/Target/BPF/BPFISelLowering.cpp ++++ b/llvm/lib/Target/BPF/BPFISelLowering.cpp +@@ -18,6 +18,7 @@ + #include "llvm/CodeGen/MachineFrameInfo.h" + #include "llvm/CodeGen/MachineFunction.h" + #include "llvm/CodeGen/MachineInstrBuilder.h" ++#include "llvm/CodeGen/MachineJumpTableInfo.h" + #include "llvm/CodeGen/MachineRegisterInfo.h" + #include "llvm/CodeGen/TargetLoweringObjectFileImpl.h" + #include "llvm/CodeGen/ValueTypes.h" +@@ -38,6 +39,10 @@ static cl::opt BPFExpandMemcpyInOrder("bpf-expand-memcpy-in-order", + cl::Hidden, cl::init(false), + cl::desc("Expand memcpy into load/store pairs in order")); + ++static cl::opt BPFMinimumJumpTableEntries( ++ "bpf-min-jump-table-entries", cl::init(13), cl::Hidden, ++ cl::desc("Set minimum number of entries to use a jump table on BPF")); ++ + static void fail(const SDLoc &DL, SelectionDAG &DAG, const Twine &Msg, + SDValue Val = {}) { + std::string Str; +@@ -67,12 +72,16 @@ BPFTargetLowering::BPFTargetLowering(const TargetMachine &TM, + + setOperationAction(ISD::BR_CC, MVT::i64, Custom); + setOperationAction(ISD::BR_JT, MVT::Other, Expand); +- setOperationAction(ISD::BRIND, MVT::Other, Expand); + setOperationAction(ISD::BRCOND, MVT::Other, Expand); + ++ if (!STI.hasGotox()) ++ setOperationAction(ISD::BRIND, MVT::Other, Expand); ++ + setOperationAction(ISD::TRAP, MVT::Other, Custom); + + setOperationAction({ISD::GlobalAddress, ISD::ConstantPool}, MVT::i64, Custom); ++ if (STI.hasGotox()) ++ setOperationAction({ISD::JumpTable, ISD::BlockAddress}, MVT::i64, Custom); + + setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i64, Custom); + setOperationAction(ISD::STACKSAVE, MVT::Other, Expand); +@@ -159,6 +168,7 @@ BPFTargetLowering::BPFTargetLowering(const TargetMachine &TM, + + setBooleanContents(ZeroOrOneBooleanContent); + setMaxAtomicSizeInBitsSupported(64); ++ setMinimumJumpTableEntries(BPFMinimumJumpTableEntries); + + // Function alignments + setMinFunctionAlignment(Align(8)); +@@ -246,6 +256,10 @@ bool BPFTargetLowering::isZExtFree(SDValue Val, EVT VT2) const { + return TargetLoweringBase::isZExtFree(Val, VT2); + } + ++unsigned BPFTargetLowering::getJumpTableEncoding() const { ++ return MachineJumpTableInfo::EK_BlockAddress; ++} ++ + BPFTargetLowering::ConstraintType + BPFTargetLowering::getConstraintType(StringRef Constraint) const { + if (Constraint.size() == 1) { +@@ -316,10 +330,14 @@ SDValue BPFTargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) const { + report_fatal_error("unimplemented opcode: " + Twine(Op.getOpcode())); + case ISD::BR_CC: + return LowerBR_CC(Op, DAG); ++ case ISD::JumpTable: ++ return LowerJumpTable(Op, DAG); + case ISD::GlobalAddress: + return LowerGlobalAddress(Op, DAG); + case ISD::ConstantPool: + return LowerConstantPool(Op, DAG); ++ case ISD::BlockAddress: ++ return LowerBlockAddress(Op, DAG); + case ISD::SELECT_CC: + return LowerSELECT_CC(Op, DAG); + case ISD::SDIV: +@@ -780,6 +798,11 @@ SDValue BPFTargetLowering::LowerTRAP(SDValue Op, SelectionDAG &DAG) const { + return LowerCall(CLI, InVals); + } + ++SDValue BPFTargetLowering::LowerJumpTable(SDValue Op, SelectionDAG &DAG) const { ++ JumpTableSDNode *N = cast(Op); ++ return getAddr(N, DAG); ++} ++ + const char *BPFTargetLowering::getTargetNodeName(unsigned Opcode) const { + switch ((BPFISD::NodeType)Opcode) { + case BPFISD::FIRST_NUMBER: +@@ -800,17 +823,17 @@ const char *BPFTargetLowering::getTargetNodeName(unsigned Opcode) const { + return nullptr; + } + +-static SDValue getTargetNode(GlobalAddressSDNode *N, const SDLoc &DL, EVT Ty, +- SelectionDAG &DAG, unsigned Flags) { +- return DAG.getTargetGlobalAddress(N->getGlobal(), DL, Ty, 0, Flags); +-} +- + static SDValue getTargetNode(ConstantPoolSDNode *N, const SDLoc &DL, EVT Ty, + SelectionDAG &DAG, unsigned Flags) { + return DAG.getTargetConstantPool(N->getConstVal(), Ty, N->getAlign(), + N->getOffset(), Flags); + } + ++static SDValue getTargetNode(JumpTableSDNode *N, const SDLoc &DL, EVT Ty, ++ SelectionDAG &DAG, unsigned Flags) { ++ return DAG.getTargetJumpTable(N->getIndex(), Ty, Flags); ++} ++ + template + SDValue BPFTargetLowering::getAddr(NodeTy *N, SelectionDAG &DAG, + unsigned Flags) const { +@@ -827,7 +850,15 @@ SDValue BPFTargetLowering::LowerGlobalAddress(SDValue Op, + if (N->getOffset() != 0) + report_fatal_error("invalid offset for global address: " + + Twine(N->getOffset())); +- return getAddr(N, DAG); ++ ++ const GlobalValue *GVal = N->getGlobal(); ++ SDLoc DL(Op); ++ ++ // Wrap it in a TargetGlobalAddress ++ SDValue Addr = DAG.getTargetGlobalAddress(GVal, DL, MVT::i64); ++ ++ // Emit pseudo instruction ++ return SDValue(DAG.getMachineNode(BPF::LDIMM64, DL, MVT::i64, Addr), 0); + } + + SDValue BPFTargetLowering::LowerConstantPool(SDValue Op, +@@ -837,6 +868,18 @@ SDValue BPFTargetLowering::LowerConstantPool(SDValue Op, + return getAddr(N, DAG); + } + ++SDValue BPFTargetLowering::LowerBlockAddress(SDValue Op, ++ SelectionDAG &DAG) const { ++ const BlockAddress *BA = cast(Op)->getBlockAddress(); ++ SDLoc DL(Op); ++ ++ // Wrap it in a TargetBlockAddress ++ SDValue Addr = DAG.getTargetBlockAddress(BA, MVT::i64); ++ ++ // Emit pseudo instruction ++ return SDValue(DAG.getMachineNode(BPF::LDIMM64, DL, MVT::i64, Addr), 0); ++} ++ + unsigned + BPFTargetLowering::EmitSubregExt(MachineInstr &MI, MachineBasicBlock *BB, + unsigned Reg, bool isSigned) const { +@@ -900,6 +943,86 @@ BPFTargetLowering::EmitInstrWithCustomInserterMemcpy(MachineInstr &MI, + return BB; + } + ++MachineBasicBlock *BPFTargetLowering::EmitInstrWithCustomInserterLDimm64( ++ MachineInstr &MI, MachineBasicBlock *BB) const { ++ MachineFunction *MF = BB->getParent(); ++ const BPFInstrInfo *TII = MF->getSubtarget().getInstrInfo(); ++ const TargetRegisterClass *RC = getRegClassFor(MVT::i64); ++ MachineRegisterInfo &RegInfo = MF->getRegInfo(); ++ DebugLoc DL = MI.getDebugLoc(); ++ ++ // Build address taken map for Global Varaibles and BlockAddresses ++ DenseMap AddressTakenBBs; ++ for (MachineBasicBlock &MBB : *MF) { ++ if (const BasicBlock *BB = MBB.getBasicBlock()) ++ if (BB->hasAddressTaken()) ++ AddressTakenBBs[BB] = &MBB; ++ } ++ ++ MachineOperand &MO = MI.getOperand(1); ++ assert(MO.isBlockAddress() || MO.isGlobal()); ++ ++ MCRegister ResultReg = MI.getOperand(0).getReg(); ++ Register TmpReg = RegInfo.createVirtualRegister(RC); ++ ++ std::vector Targets; ++ unsigned JTI; ++ ++ if (MO.isBlockAddress()) { ++ auto *BA = MO.getBlockAddress(); ++ MachineBasicBlock *TgtMBB = AddressTakenBBs[BA->getBasicBlock()]; ++ assert(TgtMBB); ++ ++ Targets.push_back(TgtMBB); ++ JTI = MF->getOrCreateJumpTableInfo(getJumpTableEncoding()) ++ ->createJumpTableIndex(Targets); ++ ++ BuildMI(*BB, MI, DL, TII->get(BPF::LD_imm64), TmpReg) ++ .addJumpTableIndex(JTI); ++ BuildMI(*BB, MI, DL, TII->get(BPF::LDD), ResultReg) ++ .addReg(TmpReg) ++ .addImm(0); ++ MI.eraseFromParent(); ++ return BB; ++ } ++ ++ // Helper: emit LD_imm64 with operand GlobalAddress or JumpTable ++ auto emitLDImm64 = [&](const GlobalValue *GV = nullptr, unsigned JTI = -1) { ++ auto MIB = BuildMI(*BB, MI, DL, TII->get(BPF::LD_imm64), ResultReg); ++ if (GV) ++ MIB.addGlobalAddress(GV); ++ else ++ MIB.addJumpTableIndex(JTI); ++ MI.eraseFromParent(); ++ return BB; ++ }; ++ ++ // Must be a global at this point ++ const GlobalValue *GVal = MO.getGlobal(); ++ const auto *GV = dyn_cast(GVal); ++ ++ if (!GV || GV->getLinkage() != GlobalValue::PrivateLinkage || ++ !GV->isConstant() || !GV->hasInitializer()) ++ return emitLDImm64(GVal); ++ ++ const auto *CA = dyn_cast(GV->getInitializer()); ++ if (!CA) ++ return emitLDImm64(GVal); ++ ++ for (const Use &Op : CA->operands()) { ++ if (!isa(Op)) ++ return emitLDImm64(GVal); ++ auto *BA = cast(Op); ++ MachineBasicBlock *TgtMBB = AddressTakenBBs[BA->getBasicBlock()]; ++ assert(TgtMBB); ++ Targets.push_back(TgtMBB); ++ } ++ ++ JTI = MF->getOrCreateJumpTableInfo(getJumpTableEncoding()) ++ ->createJumpTableIndex(Targets); ++ return emitLDImm64(nullptr, JTI); ++} ++ + MachineBasicBlock * + BPFTargetLowering::EmitInstrWithCustomInserter(MachineInstr &MI, + MachineBasicBlock *BB) const { +@@ -912,6 +1035,7 @@ BPFTargetLowering::EmitInstrWithCustomInserter(MachineInstr &MI, + Opc == BPF::Select_32_64); + + bool isMemcpyOp = Opc == BPF::MEMCPY; ++ bool isLDimm64Op = Opc == BPF::LDIMM64; + + #ifndef NDEBUG + bool isSelectRIOp = (Opc == BPF::Select_Ri || +@@ -919,13 +1043,16 @@ BPFTargetLowering::EmitInstrWithCustomInserter(MachineInstr &MI, + Opc == BPF::Select_Ri_32 || + Opc == BPF::Select_Ri_32_64); + +- if (!(isSelectRROp || isSelectRIOp || isMemcpyOp)) ++ if (!(isSelectRROp || isSelectRIOp || isMemcpyOp || isLDimm64Op)) + report_fatal_error("unhandled instruction type: " + Twine(Opc)); + #endif + + if (isMemcpyOp) + return EmitInstrWithCustomInserterMemcpy(MI, BB); + ++ if (isLDimm64Op) ++ return EmitInstrWithCustomInserterLDimm64(MI, BB); ++ + bool is32BitCmp = (Opc == BPF::Select_32 || + Opc == BPF::Select_32_64 || + Opc == BPF::Select_Ri_32 || +diff --git a/llvm/lib/Target/BPF/BPFISelLowering.h b/llvm/lib/Target/BPF/BPFISelLowering.h +index 8f60261c10e9..5243d4944667 100644 +--- a/llvm/lib/Target/BPF/BPFISelLowering.h ++++ b/llvm/lib/Target/BPF/BPFISelLowering.h +@@ -66,6 +66,8 @@ public: + + MVT getScalarShiftAmountTy(const DataLayout &, EVT) const override; + ++ unsigned getJumpTableEncoding() const override; ++ + private: + // Control Instruction Selection Features + bool HasAlu32; +@@ -81,6 +83,8 @@ private: + SDValue LowerConstantPool(SDValue Op, SelectionDAG &DAG) const; + SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const; + SDValue LowerTRAP(SDValue Op, SelectionDAG &DAG) const; ++ SDValue LowerBlockAddress(SDValue Op, SelectionDAG &DAG) const; ++ SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG) const; + + template + SDValue getAddr(NodeTy *N, SelectionDAG &DAG, unsigned Flags = 0) const; +@@ -163,7 +167,9 @@ private: + MachineBasicBlock * EmitInstrWithCustomInserterMemcpy(MachineInstr &MI, + MachineBasicBlock *BB) + const; +- ++ MachineBasicBlock * ++ EmitInstrWithCustomInserterLDimm64(MachineInstr &MI, ++ MachineBasicBlock *BB) const; + }; + } + +diff --git a/llvm/lib/Target/BPF/BPFInstrInfo.cpp b/llvm/lib/Target/BPF/BPFInstrInfo.cpp +index 70bc163615f6..bf2b4213201d 100644 +--- a/llvm/lib/Target/BPF/BPFInstrInfo.cpp ++++ b/llvm/lib/Target/BPF/BPFInstrInfo.cpp +@@ -181,6 +181,11 @@ bool BPFInstrInfo::analyzeBranch(MachineBasicBlock &MBB, + if (!isUnpredicatedTerminator(*I)) + break; + ++ // From base method doc: ... returning true if it cannot be understood ... ++ // Indirect branch has multiple destinations and no true/false concepts. ++ if (I->isIndirectBranch()) ++ return true; ++ + // A terminator that isn't a branch can't easily be handled + // by this analysis. + if (!I->isBranch()) +@@ -259,3 +264,43 @@ unsigned BPFInstrInfo::removeBranch(MachineBasicBlock &MBB, + + return Count; + } ++ ++int BPFInstrInfo::getJumpTableIndex(const MachineInstr &MI) const { ++ if (MI.getOpcode() != BPF::JX) ++ return -1; ++ ++ // The pattern looks like: ++ // %0 = LD_imm64 %jump-table.0 ; load jump-table address ++ // %1 = ADD_rr %0, $another_reg ; address + offset ++ // %2 = LDD %1, 0 ; load the actual label ++ // JX %2 ++ const MachineFunction &MF = *MI.getParent()->getParent(); ++ const MachineRegisterInfo &MRI = MF.getRegInfo(); ++ ++ Register Reg = MI.getOperand(0).getReg(); ++ if (!Reg.isVirtual()) ++ return -1; ++ MachineInstr *Ldd = MRI.getUniqueVRegDef(Reg); ++ if (Ldd == nullptr || Ldd->getOpcode() != BPF::LDD) ++ return -1; ++ ++ Reg = Ldd->getOperand(1).getReg(); ++ if (!Reg.isVirtual()) ++ return -1; ++ MachineInstr *Add = MRI.getUniqueVRegDef(Reg); ++ if (Add == nullptr || Add->getOpcode() != BPF::ADD_rr) ++ return -1; ++ ++ Reg = Add->getOperand(1).getReg(); ++ if (!Reg.isVirtual()) ++ return -1; ++ MachineInstr *LDimm64 = MRI.getUniqueVRegDef(Reg); ++ if (LDimm64 == nullptr || LDimm64->getOpcode() != BPF::LD_imm64) ++ return -1; ++ ++ const MachineOperand &MO = LDimm64->getOperand(1); ++ if (!MO.isJTI()) ++ return -1; ++ ++ return MO.getIndex(); ++} +diff --git a/llvm/lib/Target/BPF/BPFInstrInfo.h b/llvm/lib/Target/BPF/BPFInstrInfo.h +index d8bbad44e314..d88e37975980 100644 +--- a/llvm/lib/Target/BPF/BPFInstrInfo.h ++++ b/llvm/lib/Target/BPF/BPFInstrInfo.h +@@ -58,6 +58,9 @@ public: + MachineBasicBlock *FBB, ArrayRef Cond, + const DebugLoc &DL, + int *BytesAdded = nullptr) const override; ++ ++ int getJumpTableIndex(const MachineInstr &MI) const override; ++ + private: + void expandMEMCPY(MachineBasicBlock::iterator) const; + +diff --git a/llvm/lib/Target/BPF/BPFInstrInfo.td b/llvm/lib/Target/BPF/BPFInstrInfo.td +index b21f1a0eee3b..9d3ac7ffa6ff 100644 +--- a/llvm/lib/Target/BPF/BPFInstrInfo.td ++++ b/llvm/lib/Target/BPF/BPFInstrInfo.td +@@ -61,6 +61,7 @@ def BPFNoMovsx : Predicate<"!Subtarget->hasMovsx()">; + def BPFNoBswap : Predicate<"!Subtarget->hasBswap()">; + def BPFHasStoreImm : Predicate<"Subtarget->hasStoreImm()">; + def BPFHasLoadAcqStoreRel : Predicate<"Subtarget->hasLoadAcqStoreRel()">; ++def BPFHasGotox : Predicate<"Subtarget->hasGotox()">; + + class ImmediateAsmOperand : AsmOperandClass { + let Name = name; +@@ -216,6 +217,18 @@ class JMP_RI + let BPFClass = BPF_JMP; + } + ++class JMP_IND Pattern> ++ : TYPE_ALU_JMP { ++ bits<4> dst; ++ ++ let Inst{51-48} = dst; ++ let BPFClass = BPF_JMP; ++} ++ + class JMP_JCOND Pattern> + : TYPE_ALU_JMP; + defm JSLE : J; + def JCOND : JMP_JCOND; ++ ++let Predicates = [BPFHasGotox] in { ++ let isIndirectBranch = 1, isBarrier = 1 in { ++ def JX : JMP_IND; ++ } ++} + } + + // ALU instructions +@@ -849,8 +868,8 @@ let usesCustomInserter = 1, isCodeGenOnly = 1 in { + } + + // load 64-bit global addr into register +-def : Pat<(BPFWrapper tglobaladdr:$in), (LD_imm64 tglobaladdr:$in)>; + def : Pat<(BPFWrapper tconstpool:$in), (LD_imm64 tconstpool:$in)>; ++def : Pat<(BPFWrapper tjumptable:$in), (LD_imm64 tjumptable:$in)>; + + // 0xffffFFFF doesn't fit into simm32, optimize common case + def : Pat<(i64 (and (i64 GPR:$src), 0xffffFFFF)), +@@ -1372,3 +1391,8 @@ let usesCustomInserter = 1, isCodeGenOnly = 1 in { + "#memcpy dst: $dst, src: $src, len: $len, align: $align", + [(BPFmemcpy GPR:$dst, GPR:$src, imm:$len, imm:$align)]>; + } ++ ++// For GlobalValue and BlockAddress. ++let usesCustomInserter = 1, isCodeGenOnly = 1 in { ++ def LDIMM64 : Pseudo<(outs GPR:$dst), (ins i64imm:$addr), "", []>; ++} +diff --git a/llvm/lib/Target/BPF/BPFMCInstLower.cpp b/llvm/lib/Target/BPF/BPFMCInstLower.cpp +index 040a1fb75070..7d671d2c464e 100644 +--- a/llvm/lib/Target/BPF/BPFMCInstLower.cpp ++++ b/llvm/lib/Target/BPF/BPFMCInstLower.cpp +@@ -12,6 +12,8 @@ + //===----------------------------------------------------------------------===// + + #include "BPFMCInstLower.h" ++#include "BPFAsmPrinter.h" ++#include "BPFISelLowering.h" + #include "llvm/CodeGen/AsmPrinter.h" + #include "llvm/CodeGen/MachineBasicBlock.h" + #include "llvm/CodeGen/MachineInstr.h" +@@ -19,6 +21,7 @@ + #include "llvm/MC/MCContext.h" + #include "llvm/MC/MCExpr.h" + #include "llvm/MC/MCInst.h" ++#include "llvm/MC/MCStreamer.h" + #include "llvm/Support/ErrorHandling.h" + #include "llvm/Support/raw_ostream.h" + using namespace llvm; +@@ -77,6 +80,9 @@ void BPFMCInstLower::Lower(const MachineInstr *MI, MCInst &OutMI) const { + case MachineOperand::MO_ConstantPoolIndex: + MCOp = LowerSymbolOperand(MO, Printer.GetCPISymbol(MO.getIndex())); + break; ++ case MachineOperand::MO_JumpTableIndex: ++ MCOp = LowerSymbolOperand(MO, Printer.getJTPublicSymbol(MO.getIndex())); ++ break; + } + + OutMI.addOperand(MCOp); +diff --git a/llvm/lib/Target/BPF/BPFMCInstLower.h b/llvm/lib/Target/BPF/BPFMCInstLower.h +index 4bd0f1f0bf1c..483edd9a0283 100644 +--- a/llvm/lib/Target/BPF/BPFMCInstLower.h ++++ b/llvm/lib/Target/BPF/BPFMCInstLower.h +@@ -12,7 +12,7 @@ + #include "llvm/Support/Compiler.h" + + namespace llvm { +-class AsmPrinter; ++class BPFAsmPrinter; + class MCContext; + class MCInst; + class MCOperand; +@@ -24,10 +24,10 @@ class MachineOperand; + class LLVM_LIBRARY_VISIBILITY BPFMCInstLower { + MCContext &Ctx; + +- AsmPrinter &Printer; ++ BPFAsmPrinter &Printer; + + public: +- BPFMCInstLower(MCContext &ctx, AsmPrinter &printer) ++ BPFMCInstLower(MCContext &ctx, BPFAsmPrinter &printer) + : Ctx(ctx), Printer(printer) {} + void Lower(const MachineInstr *MI, MCInst &OutMI) const; + +diff --git a/llvm/lib/Target/BPF/BPFSubtarget.cpp b/llvm/lib/Target/BPF/BPFSubtarget.cpp +index 4167547680b1..a11aa6933147 100644 +--- a/llvm/lib/Target/BPF/BPFSubtarget.cpp ++++ b/llvm/lib/Target/BPF/BPFSubtarget.cpp +@@ -43,6 +43,8 @@ static cl::opt + static cl::opt Disable_load_acq_store_rel( + "disable-load-acq-store-rel", cl::Hidden, cl::init(false), + cl::desc("Disable load-acquire and store-release insns")); ++static cl::opt Disable_gotox("disable-gotox", cl::Hidden, cl::init(false), ++ cl::desc("Disable gotox insn")); + + void BPFSubtarget::anchor() {} + +@@ -66,6 +68,7 @@ void BPFSubtarget::initializeEnvironment() { + HasGotol = false; + HasStoreImm = false; + HasLoadAcqStoreRel = false; ++ HasGotox = false; + } + + void BPFSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) { +@@ -96,6 +99,7 @@ void BPFSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) { + HasGotol = !Disable_gotol; + HasStoreImm = !Disable_StoreImm; + HasLoadAcqStoreRel = !Disable_load_acq_store_rel; ++ HasGotox = !Disable_gotox; + return; + } + } +diff --git a/llvm/lib/Target/BPF/BPFSubtarget.h b/llvm/lib/Target/BPF/BPFSubtarget.h +index aed2211265e2..e870dfdc85ec 100644 +--- a/llvm/lib/Target/BPF/BPFSubtarget.h ++++ b/llvm/lib/Target/BPF/BPFSubtarget.h +@@ -65,7 +65,7 @@ protected: + + // whether cpu v4 insns are enabled. + bool HasLdsx, HasMovsx, HasBswap, HasSdivSmod, HasGotol, HasStoreImm, +- HasLoadAcqStoreRel; ++ HasLoadAcqStoreRel, HasGotox; + + std::unique_ptr CallLoweringInfo; + std::unique_ptr InstSelector; +@@ -94,6 +94,7 @@ public: + bool hasGotol() const { return HasGotol; } + bool hasStoreImm() const { return HasStoreImm; } + bool hasLoadAcqStoreRel() const { return HasLoadAcqStoreRel; } ++ bool hasGotox() const { return HasGotox; } + + bool isLittleEndian() const { return IsLittleEndian; } + +diff --git a/llvm/lib/Target/BPF/BPFTargetLoweringObjectFile.cpp b/llvm/lib/Target/BPF/BPFTargetLoweringObjectFile.cpp +new file mode 100644 +index 000000000000..997f09870bad +--- /dev/null ++++ b/llvm/lib/Target/BPF/BPFTargetLoweringObjectFile.cpp +@@ -0,0 +1,19 @@ ++//===------------------ BPFTargetLoweringObjectFile.cpp -------------------===// ++// ++// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. ++// See https://llvm.org/LICENSE.txt for license information. ++// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ++// ++//===----------------------------------------------------------------------===// ++ ++#include "BPFTargetLoweringObjectFile.h" ++#include "llvm/MC/MCContext.h" ++#include "llvm/MC/MCSectionELF.h" ++ ++using namespace llvm; ++ ++MCSection *BPFTargetLoweringObjectFileELF::getSectionForJumpTable( ++ const Function &F, const TargetMachine &TM, ++ const MachineJumpTableEntry *JTE) const { ++ return getContext().getELFSection(".jumptables", ELF::SHT_PROGBITS, 0); ++} +diff --git a/llvm/lib/Target/BPF/BPFTargetLoweringObjectFile.h b/llvm/lib/Target/BPF/BPFTargetLoweringObjectFile.h +new file mode 100644 +index 000000000000..f3064c0c8cb8 +--- /dev/null ++++ b/llvm/lib/Target/BPF/BPFTargetLoweringObjectFile.h +@@ -0,0 +1,25 @@ ++//===============- BPFTargetLoweringObjectFile.h -*- C++ -*-================// ++// ++// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. ++// See https://llvm.org/LICENSE.txt for license information. ++// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ++// ++//===----------------------------------------------------------------------===// ++ ++#ifndef LLVM_LIB_TARGET_BPF_BPFTARGETLOWERINGOBJECTFILE ++#define LLVM_LIB_TARGET_BPF_BPFTARGETLOWERINGOBJECTFILE ++ ++#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h" ++#include "llvm/Target/TargetLoweringObjectFile.h" ++ ++namespace llvm { ++class BPFTargetLoweringObjectFileELF : public TargetLoweringObjectFileELF { ++ ++public: ++ virtual MCSection * ++ getSectionForJumpTable(const Function &F, const TargetMachine &TM, ++ const MachineJumpTableEntry *JTE) const override; ++}; ++} // namespace llvm ++ ++#endif // LLVM_LIB_TARGET_BPF_BPFTARGETLOWERINGOBJECTFILE +diff --git a/llvm/lib/Target/BPF/BPFTargetMachine.cpp b/llvm/lib/Target/BPF/BPFTargetMachine.cpp +index 527a48035457..d538b6fe1167 100644 +--- a/llvm/lib/Target/BPF/BPFTargetMachine.cpp ++++ b/llvm/lib/Target/BPF/BPFTargetMachine.cpp +@@ -12,6 +12,7 @@ + + #include "BPFTargetMachine.h" + #include "BPF.h" ++#include "BPFTargetLoweringObjectFile.h" + #include "BPFTargetTransformInfo.h" + #include "MCTargetDesc/BPFMCAsmInfo.h" + #include "TargetInfo/BPFTargetInfo.h" +@@ -80,7 +81,7 @@ BPFTargetMachine::BPFTargetMachine(const Target &T, const Triple &TT, + : CodeGenTargetMachineImpl(T, computeDataLayout(TT), TT, CPU, FS, Options, + getEffectiveRelocModel(RM), + getEffectiveCodeModel(CM, CodeModel::Small), OL), +- TLOF(std::make_unique()), ++ TLOF(std::make_unique()), + Subtarget(TT, std::string(CPU), std::string(FS), *this) { + if (!DisableCheckUnreachable) { + this->Options.TrapUnreachable = true; +diff --git a/llvm/lib/Target/BPF/CMakeLists.txt b/llvm/lib/Target/BPF/CMakeLists.txt +index eade4cacb710..3678f1335ca3 100644 +--- a/llvm/lib/Target/BPF/CMakeLists.txt ++++ b/llvm/lib/Target/BPF/CMakeLists.txt +@@ -37,6 +37,7 @@ add_llvm_target(BPFCodeGen + BPFRegisterInfo.cpp + BPFSelectionDAGInfo.cpp + BPFSubtarget.cpp ++ BPFTargetLoweringObjectFile.cpp + BPFTargetMachine.cpp + BPFMIPeephole.cpp + BPFMIChecking.cpp +diff --git a/llvm/test/CodeGen/BPF/jump_table_blockaddr.ll b/llvm/test/CodeGen/BPF/jump_table_blockaddr.ll +new file mode 100644 +index 000000000000..d5a1d63b644a +--- /dev/null ++++ b/llvm/test/CodeGen/BPF/jump_table_blockaddr.ll +@@ -0,0 +1,91 @@ ++; Checks generated using command: ++; llvm/utils/update_test_body.py llvm/test/CodeGen/BPF/jump_table_blockaddr.ll ++ ++; RUN: rm -rf %t && split-file %s %t && cd %t ++; RUN: llc -march=bpf -mcpu=v4 < test.ll | FileCheck %s ++; ++; Source code: ++; int bar(int a) { ++; __label__ l1, l2; ++; void * volatile tgt; ++; int ret = 0; ++; if (a) ++; tgt = &&l1; // synthetic jump table generated here ++; else ++; tgt = &&l2; // another synthetic jump table ++; goto *tgt; ++; l1: ret += 1; ++; l2: ret += 2; ++; return ret; ++; } ++; ++; Compilation Flags: ++; clang --target=bpf -mcpu=v4 -O2 -emit-llvm -S test.c ++ ++.ifdef GEN ++;--- test.ll ++define dso_local range(i32 2, 4) i32 @bar(i32 noundef %a) local_unnamed_addr{ ++entry: ++ %tgt = alloca ptr, align 8 ++ %tobool.not = icmp eq i32 %a, 0 ++ %. = select i1 %tobool.not, ptr blockaddress(@bar, %l2), ptr blockaddress(@bar, %l1) ++ store volatile ptr %., ptr %tgt, align 8 ++ %tgt.0.tgt.0.tgt.0.tgt.0. = load volatile ptr, ptr %tgt, align 8 ++ indirectbr ptr %tgt.0.tgt.0.tgt.0.tgt.0., [label %l1, label %l2] ++ ++l1: ; preds = %entry ++ br label %l2 ++ ++l2: ; preds = %l1, %entry ++ %ret.0 = phi i32 [ 3, %l1 ], [ 2, %entry ] ++ ret i32 %ret.0 ++} ++ ++;--- gen ++echo "" ++echo "; Generated checks follow" ++echo ";" ++llc -march=bpf -mcpu=v4 < test.ll \ ++ | awk '/# -- End function/ {p=0} /@function/ {p=1} p {print "; CHECK" ": " $0}' ++ ++.endif ++ ++; Generated checks follow ++; ++; CHECK: .type bar,@function ++; CHECK: bar: # @bar ++; CHECK: .Lbar$local: ++; CHECK: .type .Lbar$local,@function ++; CHECK: .cfi_startproc ++; CHECK: # %bb.0: # %entry ++; CHECK: r2 = BPF.JT.0.0 ll ++; CHECK: r2 = *(u64 *)(r2 + 0) ++; CHECK: r3 = BPF.JT.0.1 ll ++; CHECK: r3 = *(u64 *)(r3 + 0) ++; CHECK: if w1 == 0 goto LBB0_2 ++; CHECK: # %bb.1: # %entry ++; CHECK: r3 = r2 ++; CHECK: LBB0_2: # %entry ++; CHECK: *(u64 *)(r10 - 8) = r3 ++; CHECK: r1 = *(u64 *)(r10 - 8) ++; CHECK: gotox r1 ++; CHECK: .Ltmp0: # Block address taken ++; CHECK: LBB0_3: # %l1 ++; CHECK: w0 = 3 ++; CHECK: goto LBB0_5 ++; CHECK: .Ltmp1: # Block address taken ++; CHECK: LBB0_4: # %l2 ++; CHECK: w0 = 2 ++; CHECK: LBB0_5: # %.split ++; CHECK: exit ++; CHECK: .Lfunc_end0: ++; CHECK: .size bar, .Lfunc_end0-bar ++; CHECK: .size .Lbar$local, .Lfunc_end0-bar ++; CHECK: .cfi_endproc ++; CHECK: .section .jumptables,"",@progbits ++; CHECK: BPF.JT.0.0: ++; CHECK: .quad LBB0_3 ++; CHECK: .size BPF.JT.0.0, 8 ++; CHECK: BPF.JT.0.1: ++; CHECK: .quad LBB0_4 ++; CHECK: .size BPF.JT.0.1, 8 +diff --git a/llvm/test/CodeGen/BPF/jump_table_global_var.ll b/llvm/test/CodeGen/BPF/jump_table_global_var.ll +new file mode 100644 +index 000000000000..bbca46850843 +--- /dev/null ++++ b/llvm/test/CodeGen/BPF/jump_table_global_var.ll +@@ -0,0 +1,83 @@ ++; Checks generated using command: ++; llvm/utils/update_test_body.py llvm/test/CodeGen/BPF/jump_table_global_var.ll ++ ++; RUN: rm -rf %t && split-file %s %t && cd %t ++; RUN: llc -march=bpf -mcpu=v4 < test.ll | FileCheck %s ++; ++; Source code: ++; int foo(unsigned a) { ++; __label__ l1, l2; ++; void *jt1[] = {[0]=&&l1, [1]=&&l2}; ++; int ret = 0; ++; ++; goto *jt1[a % 2]; ++; l1: ret += 1; ++; l2: ret += 3; ++; return ret; ++; } ++; ++; Compilation Flags: ++; clang --target=bpf -mcpu=v4 -O2 -emit-llvm -S test.c ++ ++.ifdef GEN ++;--- test.ll ++@__const.foo.jt1 = private unnamed_addr constant [2 x ptr] [ptr blockaddress(@foo, %l1), ptr blockaddress(@foo, %l2)], align 8 ++ ++define dso_local range(i32 3, 5) i32 @foo(i32 noundef %a) local_unnamed_addr { ++entry: ++ %rem = and i32 %a, 1 ++ %idxprom = zext nneg i32 %rem to i64 ++ %arrayidx = getelementptr inbounds nuw [2 x ptr], ptr @__const.foo.jt1, i64 0, i64 %idxprom ++ %0 = load ptr, ptr %arrayidx, align 8 ++ indirectbr ptr %0, [label %l1, label %l2] ++ ++l1: ; preds = %entry ++ br label %l2 ++ ++l2: ; preds = %l1, %entry ++ %ret.0 = phi i32 [ 4, %l1 ], [ 3, %entry ] ++ ret i32 %ret.0 ++} ++ ++;--- gen ++echo "" ++echo "; Generated checks follow" ++echo ";" ++llc -march=bpf -mcpu=v4 < test.ll \ ++ | awk '/# -- End function/ {p=0} /@function/ {p=1} p {print "; CHECK" ": " $0}' ++ ++.endif ++ ++; Generated checks follow ++; ++; CHECK: .type foo,@function ++; CHECK: foo: # @foo ++; CHECK: .Lfoo$local: ++; CHECK: .type .Lfoo$local,@function ++; CHECK: .cfi_startproc ++; CHECK: # %bb.0: # %entry ++; CHECK: # kill: def $w1 killed $w1 def $r1 ++; CHECK: w1 &= 1 ++; CHECK: r1 <<= 3 ++; CHECK: r2 = BPF.JT.0.0 ll ++; CHECK: r2 += r1 ++; CHECK: r1 = *(u64 *)(r2 + 0) ++; CHECK: gotox r1 ++; CHECK: .Ltmp0: # Block address taken ++; CHECK: LBB0_1: # %l1 ++; CHECK: w0 = 4 ++; CHECK: goto LBB0_3 ++; CHECK: .Ltmp1: # Block address taken ++; CHECK: LBB0_2: # %l2 ++; CHECK: w0 = 3 ++; CHECK: LBB0_3: # %.split ++; CHECK: exit ++; CHECK: .Lfunc_end0: ++; CHECK: .size foo, .Lfunc_end0-foo ++; CHECK: .size .Lfoo$local, .Lfunc_end0-foo ++; CHECK: .cfi_endproc ++; CHECK: .section .jumptables,"",@progbits ++; CHECK: BPF.JT.0.0: ++; CHECK: .quad LBB0_1 ++; CHECK: .quad LBB0_2 ++; CHECK: .size BPF.JT.0.0, 16 +diff --git a/llvm/test/CodeGen/BPF/jump_table_switch_stmt.ll b/llvm/test/CodeGen/BPF/jump_table_switch_stmt.ll +new file mode 100644 +index 000000000000..682b025d665d +--- /dev/null ++++ b/llvm/test/CodeGen/BPF/jump_table_switch_stmt.ll +@@ -0,0 +1,126 @@ ++; Checks generated using command: ++; llvm/utils/update_test_body.py llvm/test/CodeGen/BPF/jump_table_switch_stmt.ll ++ ++; RUN: rm -rf %t && split-file %s %t && cd %t ++; RUN: llc -march=bpf -mcpu=v4 -bpf-min-jump-table-entries=3 < test.ll | FileCheck %s ++; ++; Source code: ++; int ret_user; ++; int foo(int a) ++; { ++; switch (a) { ++; case 1: ret_user = 18; break; ++; case 20: ret_user = 6; break; ++; case 30: ret_user = 2; break; ++; default: break; ++; } ++; return 0; ++; } ++; ++; Compilation Flags: ++; clang --target=bpf -mcpu=v4 -O2 -emit-llvm -S test.c ++ ++.ifdef GEN ++;--- test.ll ++@ret_user = dso_local local_unnamed_addr global i32 0, align 4 ++ ++define dso_local noundef i32 @foo(i32 noundef %a) local_unnamed_addr { ++entry: ++ switch i32 %a, label %sw.epilog [ ++ i32 1, label %sw.epilog.sink.split ++ i32 20, label %sw.bb1 ++ i32 30, label %sw.bb2 ++ ] ++ ++sw.bb1: ; preds = %entry ++ br label %sw.epilog.sink.split ++ ++sw.bb2: ; preds = %entry ++ br label %sw.epilog.sink.split ++ ++sw.epilog.sink.split: ; preds = %entry, %sw.bb1, %sw.bb2 ++ %.sink = phi i32 [ 2, %sw.bb2 ], [ 6, %sw.bb1 ], [ 18, %entry ] ++ store i32 %.sink, ptr @ret_user, align 4 ++ br label %sw.epilog ++ ++sw.epilog: ; preds = %sw.epilog.sink.split, %entry ++ ret i32 0 ++} ++ ++;--- gen ++echo "" ++echo "; Generated checks follow" ++echo ";" ++llc -march=bpf -mcpu=v4 -bpf-min-jump-table-entries=3 < test.ll \ ++ | awk '/# -- End function/ {p=0} /@function/ {p=1} p {print "; CHECK" ": " $0}' ++ ++.endif ++ ++; Generated checks follow ++; ++; CHECK: .type foo,@function ++; CHECK: foo: # @foo ++; CHECK: .Lfoo$local: ++; CHECK: .type .Lfoo$local,@function ++; CHECK: .cfi_startproc ++; CHECK: # %bb.0: # %entry ++; CHECK: # kill: def $w1 killed $w1 def $r1 ++; CHECK: w1 += -1 ++; CHECK: if w1 > 29 goto LBB0_5 ++; CHECK: # %bb.1: # %entry ++; CHECK: w2 = 18 ++; CHECK: r1 <<= 3 ++; CHECK: r3 = BPF.JT.0.0 ll ++; CHECK: r4 = BPF.JT.0.0 ll ++; CHECK: r4 += r1 ++; CHECK: r1 = *(u64 *)(r4 + 0) ++; CHECK: r3 += r1 ++; CHECK: gotox r3 ++; CHECK: LBB0_2: # %sw.bb1 ++; CHECK: w2 = 6 ++; CHECK: goto LBB0_4 ++; CHECK: LBB0_3: # %sw.bb2 ++; CHECK: w2 = 2 ++; CHECK: LBB0_4: # %sw.epilog.sink.split ++; CHECK: r1 = ret_user ll ++; CHECK: *(u32 *)(r1 + 0) = w2 ++; CHECK: LBB0_5: # %sw.epilog ++; CHECK: w0 = 0 ++; CHECK: exit ++; CHECK: .Lfunc_end0: ++; CHECK: .size foo, .Lfunc_end0-foo ++; CHECK: .size .Lfoo$local, .Lfunc_end0-foo ++; CHECK: .cfi_endproc ++; CHECK: .section .jumptables,"",@progbits ++; CHECK: BPF.JT.0.0: ++; CHECK: .quad LBB0_4 ++; CHECK: .quad LBB0_5 ++; CHECK: .quad LBB0_5 ++; CHECK: .quad LBB0_5 ++; CHECK: .quad LBB0_5 ++; CHECK: .quad LBB0_5 ++; CHECK: .quad LBB0_5 ++; CHECK: .quad LBB0_5 ++; CHECK: .quad LBB0_5 ++; CHECK: .quad LBB0_5 ++; CHECK: .quad LBB0_5 ++; CHECK: .quad LBB0_5 ++; CHECK: .quad LBB0_5 ++; CHECK: .quad LBB0_5 ++; CHECK: .quad LBB0_5 ++; CHECK: .quad LBB0_5 ++; CHECK: .quad LBB0_5 ++; CHECK: .quad LBB0_5 ++; CHECK: .quad LBB0_5 ++; CHECK: .quad LBB0_2 ++; CHECK: .quad LBB0_5 ++; CHECK: .quad LBB0_5 ++; CHECK: .quad LBB0_5 ++; CHECK: .quad LBB0_5 ++; CHECK: .quad LBB0_5 ++; CHECK: .quad LBB0_5 ++; CHECK: .quad LBB0_5 ++; CHECK: .quad LBB0_5 ++; CHECK: .quad LBB0_5 ++; CHECK: .quad LBB0_3 ++; CHECK: .size BPF.JT.0.0, 240 +-- +2.50.1 + diff --git a/SOURCES/0001-CGP-Bail-out-if-Base-Scaled-Reg-does-not-dominate-in.patch b/SOURCES/0001-CGP-Bail-out-if-Base-Scaled-Reg-does-not-dominate-in.patch new file mode 100644 index 0000000..0c2d067 --- /dev/null +++ b/SOURCES/0001-CGP-Bail-out-if-Base-Scaled-Reg-does-not-dominate-in.patch @@ -0,0 +1,131 @@ +From dde30a47313bf52fef02bbcb1de931a8d725659f Mon Sep 17 00:00:00 2001 +From: Florian Hahn +Date: Fri, 6 Jun 2025 12:38:30 +0100 +Subject: [PATCH] [CGP] Bail out if (Base|Scaled)Reg does not dominate insert + point. (#142949) + +(Base|Scaled)Reg may not dominate the chosen insert point, if there are +multiple uses of the address. Bail out if that's the case, otherwise we +will generate invalid IR. + +In some cases, we could probably adjust the insert point or hoist the +(Base|Scaled)Reg. + +Fixes https://github.com/llvm/llvm-project/issues/142830. + +PR: https://github.com/llvm/llvm-project/pull/142949 +--- + llvm/lib/CodeGen/CodeGenPrepare.cpp | 13 +++- + .../X86/sink-addrmode-reg-does-not-geps.ll | 76 +++++++++++++++++++ + 2 files changed, 87 insertions(+), 2 deletions(-) + create mode 100644 llvm/test/Transforms/CodeGenPrepare/X86/sink-addrmode-reg-does-not-geps.ll + +diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp +index 822ed6283117..32348a899683 100644 +--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp ++++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp +@@ -5945,8 +5945,17 @@ bool CodeGenPrepare::optimizeMemoryInst(Instruction *MemoryInst, Value *Addr, + // The current BB may be optimized multiple times, we can't guarantee the + // reuse of Addr happens later, call findInsertPos to find an appropriate + // insert position. +- IRBuilder<> Builder(MemoryInst->getParent(), +- findInsertPos(Addr, MemoryInst, SunkAddr)); ++ auto InsertPos = findInsertPos(Addr, MemoryInst, SunkAddr); ++ ++ // TODO: Adjust insert point considering (Base|Scaled)Reg if possible. ++ if (!SunkAddr) { ++ auto &DT = getDT(*MemoryInst->getFunction()); ++ if ((AddrMode.BaseReg && !DT.dominates(AddrMode.BaseReg, &*InsertPos)) || ++ (AddrMode.ScaledReg && !DT.dominates(AddrMode.ScaledReg, &*InsertPos))) ++ return Modified; ++ } ++ ++ IRBuilder<> Builder(MemoryInst->getParent(), InsertPos); + + if (SunkAddr) { + LLVM_DEBUG(dbgs() << "CGP: Reusing nonlocal addrmode: " << AddrMode +diff --git a/llvm/test/Transforms/CodeGenPrepare/X86/sink-addrmode-reg-does-not-geps.ll b/llvm/test/Transforms/CodeGenPrepare/X86/sink-addrmode-reg-does-not-geps.ll +new file mode 100644 +index 000000000000..1640bafbd0bf +--- /dev/null ++++ b/llvm/test/Transforms/CodeGenPrepare/X86/sink-addrmode-reg-does-not-geps.ll +@@ -0,0 +1,76 @@ ++; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 ++; RUN: opt -S -passes='require,function(codegenprepare)' %s | FileCheck %s ++ ++target triple = "x86_64-unknown-linux" ++ ++declare i1 @cond(float) ++ ++define void @scaled_reg_does_not_dominate_insert_point(ptr %src) { ++; CHECK-LABEL: define void @scaled_reg_does_not_dominate_insert_point( ++; CHECK-SAME: ptr [[SRC:%.*]]) { ++; CHECK-NEXT: [[BB:.*]]: ++; CHECK-NEXT: br label %[[LOOP:.*]] ++; CHECK: [[LOOP]]: ++; CHECK-NEXT: [[IV:%.*]] = phi i64 [ 0, %[[BB]] ], [ [[IV_NEXT:%.*]], %[[LOOP]] ] ++; CHECK-NEXT: [[IV_NEXT]] = add i64 [[IV]], 1 ++; CHECK-NEXT: [[SUNKADDR2:%.*]] = mul i64 [[IV_NEXT]], 2 ++; CHECK-NEXT: [[SUNKADDR3:%.*]] = getelementptr i8, ptr [[SRC]], i64 [[SUNKADDR2]] ++; CHECK-NEXT: [[SUNKADDR4:%.*]] = getelementptr i8, ptr [[SUNKADDR3]], i64 6 ++; CHECK-NEXT: [[L_0:%.*]] = load float, ptr [[SUNKADDR4]], align 4 ++; CHECK-NEXT: [[SUNKADDR:%.*]] = mul i64 [[IV]], 2 ++; CHECK-NEXT: [[SUNKADDR1:%.*]] = getelementptr i8, ptr [[SRC]], i64 [[SUNKADDR]] ++; CHECK-NEXT: [[L_1:%.*]] = load float, ptr [[SUNKADDR1]], align 4 ++; CHECK-NEXT: [[TMP0:%.*]] = call i1 @cond(float [[L_0]]) ++; CHECK-NEXT: [[C:%.*]] = call i1 @cond(float [[L_1]]) ++; CHECK-NEXT: br i1 [[C]], label %[[LOOP]], label %[[EXIT:.*]] ++; CHECK: [[EXIT]]: ++; CHECK-NEXT: ret void ++; ++bb: ++ %gep.base = getelementptr i8, ptr %src, i64 8 ++ br label %loop ++ ++loop: ++ %iv = phi i64 [ 0, %bb ], [ %iv.next, %loop ] ++ %iv.shl = shl i64 %iv, 1 ++ %gep.shl = getelementptr i8, ptr %gep.base, i64 %iv.shl ++ %gep.sub = getelementptr i8, ptr %gep.shl, i64 -8 ++ %iv.next = add i64 %iv, 1 ++ %l.0 = load float, ptr %gep.shl, align 4 ++ %l.1 = load float, ptr %gep.sub, align 4 ++ call i1 @cond(float %l.0) ++ %c = call i1 @cond(float %l.1) ++ br i1 %c, label %loop, label %exit ++ ++exit: ++ ret void ++} ++ ++define void @check_dt_after_modifying_cfg(ptr %dst, i64 %x, i8 %y, i8 %z) { ++; CHECK-LABEL: define void @check_dt_after_modifying_cfg( ++; CHECK-SAME: ptr [[DST:%.*]], i64 [[X:%.*]], i8 [[Y:%.*]], i8 [[Z:%.*]]) { ++; CHECK-NEXT: [[ENTRY:.*]]: ++; CHECK-NEXT: [[OFFSET:%.*]] = lshr i64 [[X]], 2 ++; CHECK-NEXT: [[SEL_FROZEN:%.*]] = freeze i8 [[Z]] ++; CHECK-NEXT: [[CMP:%.*]] = icmp slt i8 [[SEL_FROZEN]], 0 ++; CHECK-NEXT: br i1 [[CMP]], label %[[SELECT_END:.*]], label %[[SELECT_FALSE_SINK:.*]] ++; CHECK: [[SELECT_FALSE_SINK]]: ++; CHECK-NEXT: [[SMIN:%.*]] = tail call i8 @llvm.smin.i8(i8 [[Y]], i8 0) ++; CHECK-NEXT: br label %[[SELECT_END]] ++; CHECK: [[SELECT_END]]: ++; CHECK-NEXT: [[SEL:%.*]] = phi i8 [ 0, %[[ENTRY]] ], [ [[SMIN]], %[[SELECT_FALSE_SINK]] ] ++; CHECK-NEXT: [[SUNKADDR:%.*]] = getelementptr i8, ptr [[DST]], i64 [[OFFSET]] ++; CHECK-NEXT: store i8 [[SEL]], ptr [[SUNKADDR]], align 1 ++; CHECK-NEXT: ret void ++; ++entry: ++ %offset = lshr i64 %x, 2 ++ %gep.dst = getelementptr i8, ptr %dst, i64 %offset ++ %smin = tail call i8 @llvm.smin.i8(i8 %y, i8 0) ++ %cmp = icmp slt i8 %z, 0 ++ %sel = select i1 %cmp, i8 0, i8 %smin ++ store i8 %sel, ptr %gep.dst, align 1 ++ ret void ++} ++ ++declare i8 @llvm.smin.i8(i8, i8) #0 +-- +2.50.1 + diff --git a/SOURCES/0001-CodeGenPrepare-Make-sure-instruction-get-from-SunkAd.patch b/SOURCES/0001-CodeGenPrepare-Make-sure-instruction-get-from-SunkAd.patch new file mode 100644 index 0000000..a195bc5 --- /dev/null +++ b/SOURCES/0001-CodeGenPrepare-Make-sure-instruction-get-from-SunkAd.patch @@ -0,0 +1,143 @@ +From c76137f1cfd5758f6889236d49a65f059e6432ff Mon Sep 17 00:00:00 2001 +From: weiguozhi <57237827+weiguozhi@users.noreply.github.com> +Date: Thu, 15 May 2025 09:27:25 -0700 +Subject: [PATCH] [CodeGenPrepare] Make sure instruction get from SunkAddrs is + before MemoryInst (#139303) + +Function optimizeBlock may do optimizations on a block for multiple +times. In the first iteration of the loop, MemoryInst1 may generate a +sunk instruction and store it into SunkAddrs. In the second iteration of +the loop, MemoryInst2 may use the same address and then it can reuse the +sunk instruction stored in SunkAddrs, but MemoryInst2 may be before +MemoryInst1 and the corresponding sunk instruction. In order to avoid +use before def error, we need to find appropriate insert position for the + sunk instruction. + +Fixes #138208. + +(cherry picked from commit 59c6d70ed8120b8864e5f796e2bf3de5518a0ef0) +--- + llvm/lib/CodeGen/CodeGenPrepare.cpp | 41 ++++++++++++++--- + .../CodeGenPrepare/X86/sink-addr-reuse.ll | 44 +++++++++++++++++++ + 2 files changed, 80 insertions(+), 5 deletions(-) + create mode 100644 llvm/test/Transforms/CodeGenPrepare/X86/sink-addr-reuse.ll + +diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp +index 088062afab17..f779f4b782ae 100644 +--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp ++++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp +@@ -5728,6 +5728,35 @@ static bool IsNonLocalValue(Value *V, BasicBlock *BB) { + return false; + } + ++// Find an insert position of Addr for MemoryInst. We can't guarantee MemoryInst ++// is the first instruction that will use Addr. So we need to find the first ++// user of Addr in current BB. ++static BasicBlock::iterator findInsertPos(Value *Addr, Instruction *MemoryInst, ++ Value *SunkAddr) { ++ if (Addr->hasOneUse()) ++ return MemoryInst->getIterator(); ++ ++ // We already have a SunkAddr in current BB, but we may need to insert cast ++ // instruction after it. ++ if (SunkAddr) { ++ if (Instruction *AddrInst = dyn_cast(SunkAddr)) ++ return std::next(AddrInst->getIterator()); ++ } ++ ++ // Find the first user of Addr in current BB. ++ Instruction *Earliest = MemoryInst; ++ for (User *U : Addr->users()) { ++ Instruction *UserInst = dyn_cast(U); ++ if (UserInst && UserInst->getParent() == MemoryInst->getParent()) { ++ if (isa(UserInst) || UserInst->isDebugOrPseudoInst()) ++ continue; ++ if (UserInst->comesBefore(Earliest)) ++ Earliest = UserInst; ++ } ++ } ++ return Earliest->getIterator(); ++} ++ + /// Sink addressing mode computation immediate before MemoryInst if doing so + /// can be done without increasing register pressure. The need for the + /// register pressure constraint means this can end up being an all or nothing +@@ -5852,11 +5881,6 @@ bool CodeGenPrepare::optimizeMemoryInst(Instruction *MemoryInst, Value *Addr, + return Modified; + } + +- // Insert this computation right after this user. Since our caller is +- // scanning from the top of the BB to the bottom, reuse of the expr are +- // guaranteed to happen later. +- IRBuilder<> Builder(MemoryInst); +- + // Now that we determined the addressing expression we want to use and know + // that we have to sink it into this block. Check to see if we have already + // done this for some other load/store instr in this block. If so, reuse +@@ -5867,6 +5891,13 @@ bool CodeGenPrepare::optimizeMemoryInst(Instruction *MemoryInst, Value *Addr, + + Value *SunkAddr = SunkAddrVH.pointsToAliveValue() ? SunkAddrVH : nullptr; + Type *IntPtrTy = DL->getIntPtrType(Addr->getType()); ++ ++ // The current BB may be optimized multiple times, we can't guarantee the ++ // reuse of Addr happens later, call findInsertPos to find an appropriate ++ // insert position. ++ IRBuilder<> Builder(MemoryInst->getParent(), ++ findInsertPos(Addr, MemoryInst, SunkAddr)); ++ + if (SunkAddr) { + LLVM_DEBUG(dbgs() << "CGP: Reusing nonlocal addrmode: " << AddrMode + << " for " << *MemoryInst << "\n"); +diff --git a/llvm/test/Transforms/CodeGenPrepare/X86/sink-addr-reuse.ll b/llvm/test/Transforms/CodeGenPrepare/X86/sink-addr-reuse.ll +new file mode 100644 +index 000000000000..019f31140655 +--- /dev/null ++++ b/llvm/test/Transforms/CodeGenPrepare/X86/sink-addr-reuse.ll +@@ -0,0 +1,44 @@ ++; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 ++; RUN: opt -S -p 'require,codegenprepare' -cgpp-huge-func=0 < %s | FileCheck %s ++ ++target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" ++target triple = "x86_64-grtev4-linux-gnu" ++ ++declare void @g(ptr) ++ ++; %load and %load5 use the same address, %load5 is optimized first, %load is ++; optimized later and reuse the same address computation instruction. We must ++; make sure not to generate use before def error. ++ ++define void @f(ptr %arg) { ++; CHECK-LABEL: define void @f( ++; CHECK-SAME: ptr [[ARG:%.*]]) { ++; CHECK-NEXT: [[BB:.*:]] ++; CHECK-NEXT: [[GETELEMENTPTR:%.*]] = getelementptr i8, ptr [[ARG]], i64 -64 ++; CHECK-NEXT: call void @g(ptr [[GETELEMENTPTR]]) ++; CHECK-NEXT: [[SUNKADDR1:%.*]] = getelementptr i8, ptr [[ARG]], i64 -64 ++; CHECK-NEXT: [[LOAD:%.*]] = load ptr, ptr [[SUNKADDR1]], align 8 ++; CHECK-NEXT: [[SUNKADDR:%.*]] = getelementptr i8, ptr [[ARG]], i64 -56 ++; CHECK-NEXT: [[LOAD4:%.*]] = load i32, ptr [[SUNKADDR]], align 8 ++; CHECK-NEXT: [[LOAD5:%.*]] = load ptr, ptr [[SUNKADDR1]], align 8 ++; CHECK-NEXT: [[TMP0:%.*]] = call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 1, i32 0) ++; CHECK-NEXT: [[MATH:%.*]] = extractvalue { i32, i1 } [[TMP0]], 0 ++; CHECK-NEXT: ret void ++; ++bb: ++ %getelementptr = getelementptr i8, ptr %arg, i64 -64 ++ %getelementptr1 = getelementptr i8, ptr %arg, i64 -56 ++ call void @g(ptr %getelementptr) ++ br label %bb3 ++ ++bb3: ++ %load = load ptr, ptr %getelementptr, align 8 ++ %load4 = load i32, ptr %getelementptr1, align 8 ++ %load5 = load ptr, ptr %getelementptr, align 8 ++ %add = add i32 1, 0 ++ %icmp = icmp eq i32 %add, 0 ++ br i1 %icmp, label %bb7, label %bb7 ++ ++bb7: ++ ret void ++} +-- +2.49.0 + diff --git a/SOURCES/0001-PowerPC-Add-check-for-cast-when-shufflevector-172443.patch b/SOURCES/0001-PowerPC-Add-check-for-cast-when-shufflevector-172443.patch new file mode 100644 index 0000000..1f6c0ad --- /dev/null +++ b/SOURCES/0001-PowerPC-Add-check-for-cast-when-shufflevector-172443.patch @@ -0,0 +1,137 @@ +From 98b82f90dfb7865ae4dbfcb5a83a9e817e7894a1 Mon Sep 17 00:00:00 2001 +From: Kevin Per +Date: Thu, 18 Dec 2025 10:14:01 +0100 +Subject: [PATCH] [PowerPC]: Add check for cast when shufflevector (#172443) + +The crash happens because the cast for `Mask = +cast(Res)->getMask();` fails for node `t197: v16i8 += vector_shuffle<16,17,18,19,4,5,6,7,8,9,10,11,u,u,u,u> t196, t196`. +However, both `LHS` and `RHS` are the same node, so +`DAG.getCommutedVectorShuffle` doesn't return a `ShuffleVectorSDNode` +and crashes. The fix is to add a check before the cast is performed. + +Closes https://github.com/llvm/llvm-project/issues/172265 +--- + llvm/lib/Target/PowerPC/PPCISelLowering.cpp | 4 + + .../test/CodeGen/PowerPC/vec_shuffle_le_be.ll | 94 +++++++++++++++++++ + 2 files changed, 98 insertions(+) + create mode 100644 llvm/test/CodeGen/PowerPC/vec_shuffle_le_be.ll + +diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +index 5b1d9f814806..21297b812968 100644 +--- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp ++++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +@@ -16886,6 +16886,10 @@ SDValue PPCTargetLowering::combineVectorShuffle(ShuffleVectorSDNode *SVN, + RHS.getOpcode() != ISD::VECTOR_SHUFFLE) { + std::swap(LHS, RHS); + Res = DAG.getCommutedVectorShuffle(*SVN); ++ ++ if (!isa(Res)) ++ return Res; ++ + Mask = cast(Res)->getMask(); + } + +diff --git a/llvm/test/CodeGen/PowerPC/vec_shuffle_le_be.ll b/llvm/test/CodeGen/PowerPC/vec_shuffle_le_be.ll +new file mode 100644 +index 000000000000..24c1e54dd952 +--- /dev/null ++++ b/llvm/test/CodeGen/PowerPC/vec_shuffle_le_be.ll +@@ -0,0 +1,94 @@ ++; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ++; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64le-unknown-linux-gnu | FileCheck -check-prefix=CHECK-LE %s ++; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64-unknown-linux-gnu | FileCheck -check-prefix=CHECK-BE %s ++ ++define <32 x i32> @issue_172265(<32 x i32> %BS_ARG_1, <3 x i32> %0) { ++; CHECK-LABEL: issue_172265: ++; CHECK: # %bb.0: # %entry ++; CHECK-NEXT: addis 3, 2, .LCPI18_0@toc@ha ++; CHECK-NEXT: vspltw 3, 10, 1 ++; CHECK-NEXT: addi 3, 3, .LCPI18_0@toc@l ++; CHECK-NEXT: vmr 7, 3 ++; CHECK-NEXT: lvx 4, 0, 3 ++; CHECK-NEXT: addis 3, 2, .LCPI18_1@toc@ha ++; CHECK-NEXT: addi 3, 3, .LCPI18_1@toc@l ++; CHECK-NEXT: vmr 8, 3 ++; CHECK-NEXT: vmr 9, 3 ++; CHECK-NEXT: vperm 4, 3, 3, 4 ++; CHECK-NEXT: lvx 1, 0, 3 ++; CHECK-NEXT: addis 3, 2, .LCPI18_2@toc@ha ++; CHECK-NEXT: addi 3, 3, .LCPI18_2@toc@l ++; CHECK-NEXT: lvx 5, 0, 3 ++; CHECK-NEXT: addis 3, 2, .LCPI18_3@toc@ha ++; CHECK-NEXT: addi 3, 3, .LCPI18_3@toc@l ++; CHECK-NEXT: lvx 6, 0, 3 ++; CHECK-NEXT: addis 3, 2, .LCPI18_4@toc@ha ++; CHECK-NEXT: addi 3, 3, .LCPI18_4@toc@l ++; CHECK-NEXT: vperm 4, 2, 4, 1 ++; CHECK-NEXT: lvx 2, 0, 3 ++; CHECK-NEXT: vperm 0, 3, 3, 5 ++; CHECK-NEXT: vperm 5, 3, 3, 6 ++; CHECK-NEXT: vperm 6, 3, 3, 2 ++; CHECK-NEXT: vmr 2, 0 ++; CHECK-NEXT: blr ++; CHECK-LE-LABEL: issue_172265: ++; CHECK-LE: # %bb.0: # %entry ++; CHECK-LE-NEXT: addis 3, 2, .LCPI0_0@toc@ha ++; CHECK-LE-NEXT: xxspltw 35, 42, 1 ++; CHECK-LE-NEXT: addi 3, 3, .LCPI0_0@toc@l ++; CHECK-LE-NEXT: vmr 7, 3 ++; CHECK-LE-NEXT: vmr 8, 3 ++; CHECK-LE-NEXT: vmr 9, 3 ++; CHECK-LE-NEXT: lxvd2x 0, 0, 3 ++; CHECK-LE-NEXT: addis 3, 2, .LCPI0_1@toc@ha ++; CHECK-LE-NEXT: addi 3, 3, .LCPI0_1@toc@l ++; CHECK-LE-NEXT: lxvd2x 1, 0, 3 ++; CHECK-LE-NEXT: addis 3, 2, .LCPI0_2@toc@ha ++; CHECK-LE-NEXT: addi 3, 3, .LCPI0_2@toc@l ++; CHECK-LE-NEXT: lxvd2x 2, 0, 3 ++; CHECK-LE-NEXT: addis 3, 2, .LCPI0_3@toc@ha ++; CHECK-LE-NEXT: addi 3, 3, .LCPI0_3@toc@l ++; CHECK-LE-NEXT: xxswapd 36, 0 ++; CHECK-LE-NEXT: lxvd2x 0, 0, 3 ++; CHECK-LE-NEXT: vperm 4, 2, 3, 4 ++; CHECK-LE-NEXT: xxswapd 37, 1 ++; CHECK-LE-NEXT: vperm 2, 3, 3, 5 ++; CHECK-LE-NEXT: xxswapd 32, 2 ++; CHECK-LE-NEXT: vperm 5, 3, 3, 0 ++; CHECK-LE-NEXT: xxswapd 33, 0 ++; CHECK-LE-NEXT: vperm 6, 3, 3, 1 ++; CHECK-LE-NEXT: blr ++; ++; CHECK-BE-LABEL: issue_172265: ++; CHECK-BE: # %bb.0: # %entry ++; CHECK-BE-NEXT: addis 3, 2, .LCPI0_0@toc@ha ++; CHECK-BE-NEXT: vspltw 3, 10, 2 ++; CHECK-BE-NEXT: addi 3, 3, .LCPI0_0@toc@l ++; CHECK-BE-NEXT: vmr 7, 3 ++; CHECK-BE-NEXT: lvx 4, 0, 3 ++; CHECK-BE-NEXT: addis 3, 2, .LCPI0_2@toc@ha ++; CHECK-BE-NEXT: addi 3, 3, .LCPI0_2@toc@l ++; CHECK-BE-NEXT: lvx 5, 0, 3 ++; CHECK-BE-NEXT: addis 3, 2, .LCPI0_3@toc@ha ++; CHECK-BE-NEXT: addi 3, 3, .LCPI0_3@toc@l ++; CHECK-BE-NEXT: vperm 0, 3, 3, 5 ++; CHECK-BE-NEXT: lvx 5, 0, 3 ++; CHECK-BE-NEXT: addis 3, 2, .LCPI0_1@toc@ha ++; CHECK-BE-NEXT: addi 3, 3, .LCPI0_1@toc@l ++; CHECK-BE-NEXT: lvx 1, 0, 3 ++; CHECK-BE-NEXT: addis 3, 2, .LCPI0_4@toc@ha ++; CHECK-BE-NEXT: addi 3, 3, .LCPI0_4@toc@l ++; CHECK-BE-NEXT: vperm 4, 3, 3, 4 ++; CHECK-BE-NEXT: vperm 4, 4, 2, 1 ++; CHECK-BE-NEXT: lvx 2, 0, 3 ++; CHECK-BE-NEXT: vperm 5, 3, 3, 5 ++; CHECK-BE-NEXT: vperm 6, 3, 3, 2 ++; CHECK-BE-NEXT: vmr 2, 0 ++; CHECK-BE-NEXT: vmr 8, 3 ++; CHECK-BE-NEXT: vmr 9, 3 ++; CHECK-BE-NEXT: blr ++entry: ++ %vecinit37 = shufflevector <3 x i32> %0, <3 x i32> zeroinitializer, <32 x i32> ++ %shuffle56 = shufflevector <32 x i32> %vecinit37, <32 x i32> %BS_ARG_1, <32 x i32> ++ ret <32 x i32> %shuffle56 ++} +-- +2.52.0 + diff --git a/SOURCES/0001-PowerPC-Fix-handling-of-undefs-in-the-PPC-isSplatShu.patch b/SOURCES/0001-PowerPC-Fix-handling-of-undefs-in-the-PPC-isSplatShu.patch new file mode 100644 index 0000000..e3d6135 --- /dev/null +++ b/SOURCES/0001-PowerPC-Fix-handling-of-undefs-in-the-PPC-isSplatShu.patch @@ -0,0 +1,67 @@ +From 735d721de451067c3a618b309703d0b8beb9cacc Mon Sep 17 00:00:00 2001 +From: Wael Yehia +Date: Mon, 23 Jun 2025 13:22:33 -0400 +Subject: [PATCH] [PowerPC] Fix handling of undefs in the + PPC::isSplatShuffleMask query (#145149) + +Currently, the query assumes that a single undef byte implies the rest of +the `EltSize - 1` bytes are undefs, but that's not always true. +e.g. isSplatShuffleMask( +<0,1,2,3,4,5,6,7,undef,undef,undef,undef,0,1,2,3>, 8) should return +false. + +--------- + +Co-authored-by: Wael Yehia +--- + llvm/lib/Target/PowerPC/PPCISelLowering.cpp | 13 +++++++++---- + llvm/test/CodeGen/PowerPC/pr141642.ll | 13 +++++++++++++ + 2 files changed, 22 insertions(+), 4 deletions(-) + create mode 100644 llvm/test/CodeGen/PowerPC/pr141642.ll + +diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +index 421a808de667..88c6fe632d26 100644 +--- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp ++++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +@@ -2242,10 +2242,15 @@ bool PPC::isSplatShuffleMask(ShuffleVectorSDNode *N, unsigned EltSize) { + return false; + + for (unsigned i = EltSize, e = 16; i != e; i += EltSize) { +- if (N->getMaskElt(i) < 0) continue; +- for (unsigned j = 0; j != EltSize; ++j) +- if (N->getMaskElt(i+j) != N->getMaskElt(j)) +- return false; ++ // An UNDEF element is a sequence of UNDEF bytes. ++ if (N->getMaskElt(i) < 0) { ++ for (unsigned j = 1; j != EltSize; ++j) ++ if (N->getMaskElt(i + j) >= 0) ++ return false; ++ } else ++ for (unsigned j = 0; j != EltSize; ++j) ++ if (N->getMaskElt(i + j) != N->getMaskElt(j)) ++ return false; + } + return true; + } +diff --git a/llvm/test/CodeGen/PowerPC/pr141642.ll b/llvm/test/CodeGen/PowerPC/pr141642.ll +new file mode 100644 +index 000000000000..38a706574786 +--- /dev/null ++++ b/llvm/test/CodeGen/PowerPC/pr141642.ll +@@ -0,0 +1,13 @@ ++; RUN: llc -mcpu=pwr8 -mtriple=powerpc64le-unknown-linux-gnu -O0 -debug-only=selectiondag -o - < %s 2>&1 | \ ++; RUN: FileCheck %s ++; CHECK-NOT: lxvdsx ++; CHECK-NOT: LD_SPLAT ++ ++define weak_odr dso_local void @unpack(ptr noalias noundef %packed_in) local_unnamed_addr { ++entry: ++ %ld = load <2 x i32>, ptr %packed_in, align 2 ++ %shuf = shufflevector <2 x i32> %ld, <2 x i32> poison, <4 x i32> ++ %ie = insertelement <4 x i32> %shuf, i32 7, i32 2 ++ store <4 x i32> %shuf, ptr %packed_in, align 2 ++ ret void ++} +-- +2.49.0 + diff --git a/SOURCES/0001-SystemZ-Fix-code-in-widening-vector-multiplication-1.patch b/SOURCES/0001-SystemZ-Fix-code-in-widening-vector-multiplication-1.patch new file mode 100644 index 0000000..4de2dc9 --- /dev/null +++ b/SOURCES/0001-SystemZ-Fix-code-in-widening-vector-multiplication-1.patch @@ -0,0 +1,191 @@ +From fc12fc635b96e9fa521a33eb31336c539eed1918 Mon Sep 17 00:00:00 2001 +From: sujianIBM <98488060+sujianIBM@users.noreply.github.com> +Date: Thu, 31 Jul 2025 13:18:23 -0400 +Subject: [PATCH] [SystemZ] Fix code in widening vector multiplication + (#150836) + +Commit cdc7864 has an error which would wrongly fold widening +multiplications into an even/odd widening operation. +This PR fixes it and adds tests to check scenarios which should not be +folded into an even/odd widening operation are actually not. +--- + .../Target/SystemZ/SystemZISelLowering.cpp | 2 +- + llvm/test/CodeGen/SystemZ/vec-mul-07.ll | 114 ++++++++++++++++++ + 2 files changed, 115 insertions(+), 1 deletion(-) + +diff --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp +index e30d7235b81b..fb0a47dc9dc4 100644 +--- a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp ++++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp +@@ -9044,7 +9044,7 @@ static unsigned detectEvenOddMultiplyOperand(const SelectionDAG &DAG, + if (unsigned(ShuffleMask[Elt]) != 2 * Elt) + CanUseEven = false; + if (unsigned(ShuffleMask[Elt]) != 2 * Elt + 1) +- CanUseEven = true; ++ CanUseOdd = false; + } + Op = Op.getOperand(0); + if (CanUseEven) +diff --git a/llvm/test/CodeGen/SystemZ/vec-mul-07.ll b/llvm/test/CodeGen/SystemZ/vec-mul-07.ll +index 73c7a8dec5df..583561625cfc 100644 +--- a/llvm/test/CodeGen/SystemZ/vec-mul-07.ll ++++ b/llvm/test/CodeGen/SystemZ/vec-mul-07.ll +@@ -3,6 +3,23 @@ + ; + ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s + ++; Test a v16i8 -> v8i16 unsigned widening multiplication ++; which is not folded into an even/odd widening operation. ++define <8 x i16> @f1_not(<16 x i8> %val1, <16 x i8> %val2) { ++; CHECK-LABEL: f1_not: ++; CHECK: # %bb.0: ++; CHECK-NEXT: vuplhb %v0, %v24 ++; CHECK-NEXT: vuplhb %v1, %v26 ++; CHECK-NEXT: vmlhw %v24, %v0, %v1 ++; CHECK-NEXT: br %r14 ++ %shuf1 = shufflevector <16 x i8> %val1, <16 x i8> poison, <8 x i32> ++ %zext1 = zext <8 x i8> %shuf1 to <8 x i16> ++ %shuf2 = shufflevector <16 x i8> %val2, <16 x i8> poison, <8 x i32> ++ %zext2 = zext <8 x i8> %shuf2 to <8 x i16> ++ %ret = mul <8 x i16> %zext1, %zext2 ++ ret <8 x i16> %ret ++} ++ + ; Test a v16i8 (even) -> v8i16 unsigned widening multiplication. + define <8 x i16> @f1(<16 x i8> %val1, <16 x i8> %val2) { + ; CHECK-LABEL: f1: +@@ -31,6 +48,23 @@ define <8 x i16> @f2(<16 x i8> %val1, <16 x i8> %val2) { + ret <8 x i16> %ret + } + ++; Test a v16i8 -> v8i16 signed widening multiplication ++; which is not folded into an even/odd widening operation. ++define <8 x i16> @f3_not(<16 x i8> %val1, <16 x i8> %val2) { ++; CHECK-LABEL: f3_not: ++; CHECK: # %bb.0: ++; CHECK-NEXT: vuphb %v0, %v26 ++; CHECK-NEXT: vuphb %v1, %v24 ++; CHECK-NEXT: vmlhw %v24, %v1, %v0 ++; CHECK-NEXT: br %r14 ++ %shuf1 = shufflevector <16 x i8> %val1, <16 x i8> poison, <8 x i32> ++ %sext1 = sext <8 x i8> %shuf1 to <8 x i16> ++ %shuf2 = shufflevector <16 x i8> %val2, <16 x i8> poison, <8 x i32> ++ %sext2 = sext <8 x i8> %shuf2 to <8 x i16> ++ %ret = mul <8 x i16> %sext1, %sext2 ++ ret <8 x i16> %ret ++} ++ + ; Test a v16i8 (even) -> v8i16 signed widening multiplication. + define <8 x i16> @f3(<16 x i8> %val1, <16 x i8> %val2) { + ; CHECK-LABEL: f3: +@@ -59,6 +93,23 @@ define <8 x i16> @f4(<16 x i8> %val1, <16 x i8> %val2) { + ret <8 x i16> %ret + } + ++; Test a v8i16 -> v4i32 unsigned widening multiplication ++; which is not folded into an even/odd widening operation. ++define <4 x i32> @f5_not(<8 x i16> %val1, <8 x i16> %val2) { ++; CHECK-LABEL: f5_not: ++; CHECK: # %bb.0: ++; CHECK-NEXT: vuplhh %v0, %v24 ++; CHECK-NEXT: vuplhh %v1, %v26 ++; CHECK-NEXT: vmlf %v24, %v0, %v1 ++; CHECK-NEXT: br %r14 ++ %shuf1 = shufflevector <8 x i16> %val1, <8 x i16> poison, <4 x i32> ++ %zext1 = zext <4 x i16> %shuf1 to <4 x i32> ++ %shuf2 = shufflevector <8 x i16> %val2, <8 x i16> poison, <4 x i32> ++ %zext2 = zext <4 x i16> %shuf2 to <4 x i32> ++ %ret = mul <4 x i32> %zext1, %zext2 ++ ret <4 x i32> %ret ++} ++ + ; Test a v8i16 (even) -> v4i32 unsigned widening multiplication. + define <4 x i32> @f5(<8 x i16> %val1, <8 x i16> %val2) { + ; CHECK-LABEL: f5: +@@ -87,6 +138,23 @@ define <4 x i32> @f6(<8 x i16> %val1, <8 x i16> %val2) { + ret <4 x i32> %ret + } + ++; Test a v8i16 -> v4i32 signed widening multiplication ++; which is not folded into an even/odd widening operation. ++define <4 x i32> @f7_not(<8 x i16> %val1, <8 x i16> %val2) { ++; CHECK-LABEL: f7_not: ++; CHECK: # %bb.0: ++; CHECK-NEXT: vuphh %v0, %v26 ++; CHECK-NEXT: vuphh %v1, %v24 ++; CHECK-NEXT: vmlf %v24, %v1, %v0 ++; CHECK-NEXT: br %r14 ++ %shuf1 = shufflevector <8 x i16> %val1, <8 x i16> poison, <4 x i32> ++ %sext1 = sext <4 x i16> %shuf1 to <4 x i32> ++ %shuf2 = shufflevector <8 x i16> %val2, <8 x i16> poison, <4 x i32> ++ %sext2 = sext <4 x i16> %shuf2 to <4 x i32> ++ %ret = mul <4 x i32> %sext1, %sext2 ++ ret <4 x i32> %ret ++} ++ + ; Test a v8i16 (even) -> v4i32 signed widening multiplication. + define <4 x i32> @f7(<8 x i16> %val1, <8 x i16> %val2) { + ; CHECK-LABEL: f7: +@@ -115,6 +183,29 @@ define <4 x i32> @f8(<8 x i16> %val1, <8 x i16> %val2) { + ret <4 x i32> %ret + } + ++; Test a v4i32 -> v2i64 unsigned widening multiplication ++; which is not folded into an even/odd widening operation. ++define <2 x i64> @f9_not(<4 x i32> %val1, <4 x i32> %val2) { ++; CHECK-LABEL: f9_not: ++; CHECK: # %bb.0: ++; CHECK-NEXT: vuplhf %v0, %v24 ++; CHECK-NEXT: vuplhf %v1, %v26 ++; CHECK-NEXT: vlgvg %r0, %v1, 1 ++; CHECK-NEXT: vlgvg %r1, %v0, 1 ++; CHECK-NEXT: msgr %r1, %r0 ++; CHECK-NEXT: vlgvg %r0, %v1, 0 ++; CHECK-NEXT: vlgvg %r2, %v0, 0 ++; CHECK-NEXT: msgr %r2, %r0 ++; CHECK-NEXT: vlvgp %v24, %r2, %r1 ++; CHECK-NEXT: br %r14 ++ %shuf1 = shufflevector <4 x i32> %val1, <4 x i32> poison, <2 x i32> ++ %zext1 = zext <2 x i32> %shuf1 to <2 x i64> ++ %shuf2 = shufflevector <4 x i32> %val2, <4 x i32> poison, <2 x i32> ++ %zext2 = zext <2 x i32> %shuf2 to <2 x i64> ++ %ret = mul <2 x i64> %zext1, %zext2 ++ ret <2 x i64> %ret ++} ++ + ; Test a v4i32 (even) -> v2i64 unsigned widening multiplication. + define <2 x i64> @f9(<4 x i32> %val1, <4 x i32> %val2) { + ; CHECK-LABEL: f9: +@@ -143,6 +234,29 @@ define <2 x i64> @f10(<4 x i32> %val1, <4 x i32> %val2) { + ret <2 x i64> %ret + } + ++; Test a v4i32 -> v2i64 signed widening multiplication ++; which is not folded into an even/odd widening operation. ++define <2 x i64> @f11_not(<4 x i32> %val1, <4 x i32> %val2) { ++; CHECK-LABEL: f11_not: ++; CHECK: # %bb.0: ++; CHECK-NEXT: vuphf %v0, %v24 ++; CHECK-NEXT: vuphf %v1, %v26 ++; CHECK-NEXT: vlgvg %r0, %v1, 1 ++; CHECK-NEXT: vlgvg %r1, %v0, 1 ++; CHECK-NEXT: msgr %r1, %r0 ++; CHECK-NEXT: vlgvg %r0, %v1, 0 ++; CHECK-NEXT: vlgvg %r2, %v0, 0 ++; CHECK-NEXT: msgr %r2, %r0 ++; CHECK-NEXT: vlvgp %v24, %r2, %r1 ++; CHECK-NEXT: br %r14 ++ %shuf1 = shufflevector <4 x i32> %val1, <4 x i32> poison, <2 x i32> ++ %sext1 = sext <2 x i32> %shuf1 to <2 x i64> ++ %shuf2 = shufflevector <4 x i32> %val2, <4 x i32> poison, <2 x i32> ++ %sext2 = sext <2 x i32> %shuf2 to <2 x i64> ++ %ret = mul <2 x i64> %sext1, %sext2 ++ ret <2 x i64> %ret ++} ++ + ; Test a v4i32 (even) -> v2i64 signed widening multiplication. + define <2 x i64> @f11(<4 x i32> %val1, <4 x i32> %val2) { + ; CHECK-LABEL: f11: +-- +2.52.0 + diff --git a/SOURCES/0001-clang-Add-a-hack-to-fix-the-offload-build-with-the-m.patch b/SOURCES/0001-clang-Add-a-hack-to-fix-the-offload-build-with-the-m.patch new file mode 100644 index 0000000..9184a37 --- /dev/null +++ b/SOURCES/0001-clang-Add-a-hack-to-fix-the-offload-build-with-the-m.patch @@ -0,0 +1,27 @@ +From f028fc042ef2875a13c6abf3828626a313e4a8e6 Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Fri, 1 Aug 2025 15:38:22 +0000 +Subject: [PATCH] clang: Add a hack to fix the offload build with the + mtls-dialect option + +--- + clang/lib/Driver/ToolChains/CommonArgs.cpp | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp +index 097d186ad8ea..0dc9e60f8428 100644 +--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp ++++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp +@@ -920,6 +920,9 @@ bool tools::isTLSDESCEnabled(const ToolChain &TC, + } else if (Triple.isX86()) { + SupportedArgument = V == "gnu" || V == "gnu2"; + EnableTLSDESC = V == "gnu2"; ++ } else if( Triple.isGPU()) { ++ // HACK To fix the offload build. ++ return false; + } else { + Unsupported = true; + } +-- +2.49.0 + diff --git a/SOURCES/0001-cmake-Resolve-symlink-when-finding-install-prefix.patch b/SOURCES/0001-cmake-Resolve-symlink-when-finding-install-prefix.patch new file mode 100644 index 0000000..2b62da0 --- /dev/null +++ b/SOURCES/0001-cmake-Resolve-symlink-when-finding-install-prefix.patch @@ -0,0 +1,39 @@ +From 06774eb8a7dc0bc36b59e53310c7f5b5d89f6c29 Mon Sep 17 00:00:00 2001 +From: Nikita Popov +Date: Tue, 28 Jan 2025 12:31:49 +0100 +Subject: [PATCH] [cmake] Resolve symlink when finding install prefix + +When determining the install prefix in LLVMConfig.cmake etc resolve +symlinks in CMAKE_CURRENT_LIST_FILE first. The motivation for this +is to support symlinks like `/usr/lib64/cmake/llvm` to +`/usr/lib64/llvm19/lib/cmake/llvm`. This only works correctly if +the paths are relative to the resolved symlink. + +It's worth noting that this *mostly* already works out of the box, +because cmake automatically does the symlink resolution when the +library is found via CMAKE_PREFIX_PATH. It just doesn't happen +when it's found via the default prefix path. +--- + cmake/Modules/FindPrefixFromConfig.cmake | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/cmake/Modules/FindPrefixFromConfig.cmake b/cmake/Modules/FindPrefixFromConfig.cmake +index 22211e4b72f2..3daff607ff84 100644 +--- a/cmake/Modules/FindPrefixFromConfig.cmake ++++ b/cmake/Modules/FindPrefixFromConfig.cmake +@@ -39,10 +39,10 @@ function(find_prefix_from_config out_var prefix_var path_to_leave) + # install prefix, and avoid hard-coding any absolute paths. + set(config_code + "# Compute the installation prefix from this LLVMConfig.cmake file location." +- "get_filename_component(${prefix_var} \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)") ++ "get_filename_component(${prefix_var} \"\${CMAKE_CURRENT_LIST_FILE}\" REALPATH)") + # Construct the proper number of get_filename_component(... PATH) + # calls to compute the installation prefix. +- string(REGEX REPLACE "/" ";" _count "${path_to_leave}") ++ string(REGEX REPLACE "/" ";" _count "${path_to_leave}/plus_one") + foreach(p ${_count}) + list(APPEND config_code + "get_filename_component(${prefix_var} \"\${${prefix_var}}\" PATH)") +-- +2.48.1 + diff --git a/SOURCES/0001-lld-Adjust-compressed-debug-level-test-for-s390x-wit.patch b/SOURCES/0001-lld-Adjust-compressed-debug-level-test-for-s390x-wit.patch new file mode 100644 index 0000000..20dd146 --- /dev/null +++ b/SOURCES/0001-lld-Adjust-compressed-debug-level-test-for-s390x-wit.patch @@ -0,0 +1,29 @@ +From 4fbbdb4f6b95158b87e1b072b3a246722ccf3b7d Mon Sep 17 00:00:00 2001 +From: Nikita Popov +Date: Fri, 19 Dec 2025 17:02:24 +0100 +Subject: [PATCH] [lld] Adjust compressed-debug-level test for s390x with + DFLTCC (#172972) + +After enabling DFLTCC in zlib-ng for s390x this test starts failing, +because slightly better compression is produced at level 1. Add 1c as a +permissible output. +--- + lld/test/ELF/compressed-debug-level.test | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lld/test/ELF/compressed-debug-level.test b/lld/test/ELF/compressed-debug-level.test +index 5a4d37e31eca..7d64298e518f 100644 +--- a/lld/test/ELF/compressed-debug-level.test ++++ b/lld/test/ELF/compressed-debug-level.test +@@ -18,7 +18,7 @@ + # RUN: llvm-readelf --sections %t.6 | FileCheck -check-prefixes=HEADER,LEVEL6 %s + + # HEADER: [Nr] Name Type Address Off Size +-# LEVEL1: [ 1] .debug_info PROGBITS 00000000 000094 0000{{1[def]|21}} ++# LEVEL1: [ 1] .debug_info PROGBITS 00000000 000094 0000{{1[cdef]|21}} + # LEVEL6: [ 1] .debug_info PROGBITS 00000000 000094 00001{{[abc]}} + + ## A little arbitrary debug section which has a different size after +-- +2.50.1 + diff --git a/SOURCES/0001-openmp-Add-option-to-disable-tsan-tests-111548.patch b/SOURCES/0001-openmp-Add-option-to-disable-tsan-tests-111548.patch deleted file mode 100644 index 0e30347..0000000 --- a/SOURCES/0001-openmp-Add-option-to-disable-tsan-tests-111548.patch +++ /dev/null @@ -1,62 +0,0 @@ -From b2edeb58b8cb3268acee425cd52b406eb60a8095 Mon Sep 17 00:00:00 2001 -From: Nikita Popov -Date: Wed, 9 Oct 2024 11:29:30 +0200 -Subject: [PATCH] [openmp] Add option to disable tsan tests (#111548) - -This adds a OPENMP_TEST_ENABLE_TSAN option that allows to override -whether tests using tsan will be enabled. The option defaults to the -existing auto-detection. - -The background here is -https://github.com/llvm/llvm-project/issues/111492, where we have some -systems where tsan doesn't work, but we do still want to build it and -run tests that don't use tsan. ---- - openmp/cmake/OpenMPTesting.cmake | 3 +++ - openmp/tools/archer/tests/CMakeLists.txt | 2 +- - openmp/tools/archer/tests/lit.site.cfg.in | 2 +- - 3 files changed, 5 insertions(+), 2 deletions(-) - -diff --git a/openmp/cmake/OpenMPTesting.cmake b/openmp/cmake/OpenMPTesting.cmake -index c67ad8b1cbd9..14cc5c67d84c 100644 ---- a/openmp/cmake/OpenMPTesting.cmake -+++ b/openmp/cmake/OpenMPTesting.cmake -@@ -163,6 +163,9 @@ else() - set(OPENMP_TEST_COMPILER_HAS_OMIT_FRAME_POINTER_FLAGS 1) - endif() - -+set(OPENMP_TEST_ENABLE_TSAN "${OPENMP_TEST_COMPILER_HAS_TSAN_FLAGS}" CACHE BOOL -+ "Whether to enable tests using tsan") -+ - # Function to set compiler features for use in lit. - function(update_test_compiler_features) - set(FEATURES "[") -diff --git a/openmp/tools/archer/tests/CMakeLists.txt b/openmp/tools/archer/tests/CMakeLists.txt -index 5de91148fa4b..412c7d63725e 100644 ---- a/openmp/tools/archer/tests/CMakeLists.txt -+++ b/openmp/tools/archer/tests/CMakeLists.txt -@@ -28,7 +28,7 @@ macro(pythonize_bool var) - endmacro() - - pythonize_bool(LIBARCHER_HAVE_LIBATOMIC) --pythonize_bool(OPENMP_TEST_COMPILER_HAS_TSAN_FLAGS) -+pythonize_bool(OPENMP_TEST_ENABLE_TSAN) - - set(ARCHER_TSAN_TEST_DEPENDENCE "") - if(TARGET tsan) -diff --git a/openmp/tools/archer/tests/lit.site.cfg.in b/openmp/tools/archer/tests/lit.site.cfg.in -index 55edfde9738e..ddcb7b8bc3a5 100644 ---- a/openmp/tools/archer/tests/lit.site.cfg.in -+++ b/openmp/tools/archer/tests/lit.site.cfg.in -@@ -12,7 +12,7 @@ config.omp_library_dir = "@LIBOMP_LIBRARY_DIR@" - config.omp_header_dir = "@LIBOMP_INCLUDE_DIR@" - config.operating_system = "@CMAKE_SYSTEM_NAME@" - config.has_libatomic = @LIBARCHER_HAVE_LIBATOMIC@ --config.has_tsan = @OPENMP_TEST_COMPILER_HAS_TSAN_FLAGS@ -+config.has_tsan = @OPENMP_TEST_ENABLE_TSAN@ - - config.test_archer_flags = "@LIBARCHER_TEST_FLAGS@" - config.libarcher_obj_root = "@CMAKE_CURRENT_BINARY_DIR@" --- -2.46.0 - diff --git a/SOURCES/0001-openmp-Use-core_siblings_list-if-physical_package_id.patch b/SOURCES/0001-openmp-Use-core_siblings_list-if-physical_package_id.patch deleted file mode 100644 index bacb81f..0000000 --- a/SOURCES/0001-openmp-Use-core_siblings_list-if-physical_package_id.patch +++ /dev/null @@ -1,205 +0,0 @@ -From 5fb4d7f6079a76b2907ccc8c53c7c509c30a3dca Mon Sep 17 00:00:00 2001 -From: Nikita Popov -Date: Thu, 10 Oct 2024 12:47:33 +0000 -Subject: [PATCH] [openmp] Use core_siblings_list if physical_package_id not - available - -On powerpc, physical_package_id may not be available. Currently, -this causes openmp to fall back to flat topology and various -affinity tests fail. - -Fix this by parsing core_siblings_list to deterimine which cpus -belong to the same socket. This matches what the testing code -does. The code to parse the CPU list format thankfully already -exists. - -Fixes https://github.com/llvm/llvm-project/issues/111809. ---- - openmp/runtime/src/kmp_affinity.cpp | 100 +++++++++++++------ - openmp/runtime/test/affinity/kmp-hw-subset.c | 2 +- - 2 files changed, 72 insertions(+), 30 deletions(-) - -diff --git a/openmp/runtime/src/kmp_affinity.cpp b/openmp/runtime/src/kmp_affinity.cpp -index cf5cad04eb57..c3d5ecf1345e 100644 ---- a/openmp/runtime/src/kmp_affinity.cpp -+++ b/openmp/runtime/src/kmp_affinity.cpp -@@ -1589,15 +1589,13 @@ kmp_str_buf_t *__kmp_affinity_str_buf_mask(kmp_str_buf_t *buf, - return buf; - } - --// Return (possibly empty) affinity mask representing the offline CPUs --// Caller must free the mask --kmp_affin_mask_t *__kmp_affinity_get_offline_cpus() { -- kmp_affin_mask_t *offline; -- KMP_CPU_ALLOC(offline); -- KMP_CPU_ZERO(offline); -+static kmp_affin_mask_t *__kmp_parse_cpu_list(const char *path) { -+ kmp_affin_mask_t *mask; -+ KMP_CPU_ALLOC(mask); -+ KMP_CPU_ZERO(mask); - #if KMP_OS_LINUX - int n, begin_cpu, end_cpu; -- kmp_safe_raii_file_t offline_file; -+ kmp_safe_raii_file_t file; - auto skip_ws = [](FILE *f) { - int c; - do { -@@ -1606,29 +1604,29 @@ kmp_affin_mask_t *__kmp_affinity_get_offline_cpus() { - if (c != EOF) - ungetc(c, f); - }; -- // File contains CSV of integer ranges representing the offline CPUs -+ // File contains CSV of integer ranges representing the CPUs - // e.g., 1,2,4-7,9,11-15 -- int status = offline_file.try_open("/sys/devices/system/cpu/offline", "r"); -+ int status = file.try_open(path, "r"); - if (status != 0) -- return offline; -- while (!feof(offline_file)) { -- skip_ws(offline_file); -- n = fscanf(offline_file, "%d", &begin_cpu); -+ return mask; -+ while (!feof(file)) { -+ skip_ws(file); -+ n = fscanf(file, "%d", &begin_cpu); - if (n != 1) - break; -- skip_ws(offline_file); -- int c = fgetc(offline_file); -+ skip_ws(file); -+ int c = fgetc(file); - if (c == EOF || c == ',') { - // Just single CPU - end_cpu = begin_cpu; - } else if (c == '-') { - // Range of CPUs -- skip_ws(offline_file); -- n = fscanf(offline_file, "%d", &end_cpu); -+ skip_ws(file); -+ n = fscanf(file, "%d", &end_cpu); - if (n != 1) - break; -- skip_ws(offline_file); -- c = fgetc(offline_file); // skip ',' -+ skip_ws(file); -+ c = fgetc(file); // skip ',' - } else { - // Syntax problem - break; -@@ -1638,13 +1636,19 @@ kmp_affin_mask_t *__kmp_affinity_get_offline_cpus() { - end_cpu >= __kmp_xproc || begin_cpu > end_cpu) { - continue; - } -- // Insert [begin_cpu, end_cpu] into offline mask -+ // Insert [begin_cpu, end_cpu] into mask - for (int cpu = begin_cpu; cpu <= end_cpu; ++cpu) { -- KMP_CPU_SET(cpu, offline); -+ KMP_CPU_SET(cpu, mask); - } - } - #endif -- return offline; -+ return mask; -+} -+ -+// Return (possibly empty) affinity mask representing the offline CPUs -+// Caller must free the mask -+kmp_affin_mask_t *__kmp_affinity_get_offline_cpus() { -+ return __kmp_parse_cpu_list("/sys/devices/system/cpu/offline"); - } - - // Return the number of available procs -@@ -3175,6 +3179,37 @@ static inline const char *__kmp_cpuinfo_get_envvar() { - return envvar; - } - -+static bool __kmp_package_id_from_core_siblings_list(unsigned **threadInfo, -+ unsigned num_avail, -+ unsigned idx) { -+ if (!KMP_AFFINITY_CAPABLE()) -+ return false; -+ -+ char path[256]; -+ KMP_SNPRINTF(path, sizeof(path), -+ "/sys/devices/system/cpu/cpu%u/topology/core_siblings_list", -+ threadInfo[idx][osIdIndex]); -+ kmp_affin_mask_t *siblings = __kmp_parse_cpu_list(path); -+ for (unsigned i = 0; i < num_avail; ++i) { -+ unsigned cpu_id = threadInfo[i][osIdIndex]; -+ KMP_ASSERT(cpu_id < __kmp_affin_mask_size * CHAR_BIT); -+ if (!KMP_CPU_ISSET(cpu_id, siblings)) -+ continue; -+ if (threadInfo[i][pkgIdIndex] == UINT_MAX) { -+ // Arbitrarily pick the first index we encounter, it only matters that -+ // the value is the same for all siblings. -+ threadInfo[i][pkgIdIndex] = idx; -+ } else if (threadInfo[i][pkgIdIndex] != idx) { -+ // Contradictory sibling lists. -+ KMP_CPU_FREE(siblings); -+ return false; -+ } -+ } -+ KMP_ASSERT(threadInfo[idx][pkgIdIndex] != UINT_MAX); -+ KMP_CPU_FREE(siblings); -+ return true; -+} -+ - // Parse /proc/cpuinfo (or an alternate file in the same format) to obtain the - // affinity map. On AIX, the map is obtained through system SRAD (Scheduler - // Resource Allocation Domain). -@@ -3550,18 +3585,13 @@ static bool __kmp_affinity_create_cpuinfo_map(int *line, - return false; - } - -- // Check for missing fields. The osId field must be there, and we -- // currently require that the physical id field is specified, also. -+ // Check for missing fields. The osId field must be there. The physical -+ // id field will be checked later. - if (threadInfo[num_avail][osIdIndex] == UINT_MAX) { - CLEANUP_THREAD_INFO; - *msg_id = kmp_i18n_str_MissingProcField; - return false; - } -- if (threadInfo[0][pkgIdIndex] == UINT_MAX) { -- CLEANUP_THREAD_INFO; -- *msg_id = kmp_i18n_str_MissingPhysicalIDField; -- return false; -- } - - // Skip this proc if it is not included in the machine model. - if (KMP_AFFINITY_CAPABLE() && -@@ -3591,6 +3621,18 @@ static bool __kmp_affinity_create_cpuinfo_map(int *line, - } - *line = 0; - -+ // At least on powerpc, Linux may return -1 for physical_package_id. Try -+ // to reconstruct topology from core_siblings_list in that case. -+ for (i = 0; i < num_avail; ++i) { -+ if (threadInfo[i][pkgIdIndex] == UINT_MAX) { -+ if (!__kmp_package_id_from_core_siblings_list(threadInfo, num_avail, i)) { -+ CLEANUP_THREAD_INFO; -+ *msg_id = kmp_i18n_str_MissingPhysicalIDField; -+ return false; -+ } -+ } -+ } -+ - #if KMP_MIC && REDUCE_TEAM_SIZE - unsigned teamSize = 0; - #endif // KMP_MIC && REDUCE_TEAM_SIZE -diff --git a/openmp/runtime/test/affinity/kmp-hw-subset.c b/openmp/runtime/test/affinity/kmp-hw-subset.c -index 606fcdfbada9..0b49969bd3b1 100644 ---- a/openmp/runtime/test/affinity/kmp-hw-subset.c -+++ b/openmp/runtime/test/affinity/kmp-hw-subset.c -@@ -25,7 +25,7 @@ static int compare_hw_subset_places(const place_list_t *openmp_places, - expected_per_place = nthreads_per_core; - } else { - expected_total = nsockets; -- expected_per_place = ncores_per_socket; -+ expected_per_place = ncores_per_socket * nthreads_per_core; - } - if (openmp_places->num_places != expected_total) { - fprintf(stderr, "error: KMP_HW_SUBSET did not half each resource layer!\n"); --- -2.47.0 - diff --git a/SOURCES/0001-profile-Use-base-vaddr-for-__llvm_write_binary_ids-n.patch b/SOURCES/0001-profile-Use-base-vaddr-for-__llvm_write_binary_ids-n.patch deleted file mode 100644 index 7f0a7cf..0000000 --- a/SOURCES/0001-profile-Use-base-vaddr-for-__llvm_write_binary_ids-n.patch +++ /dev/null @@ -1,86 +0,0 @@ -From ccc2b792e57d632bc887b226a4e7f0a8189eab8b Mon Sep 17 00:00:00 2001 -From: Josh Stone -Date: Mon, 4 Nov 2024 16:37:49 -0800 -Subject: [PATCH] [profile] Use base+vaddr for `__llvm_write_binary_ids` note - pointers - -This function is always examining its own ELF headers in memory, but it -was trying to use conditions between examining files or memory, and it -wasn't accounting for LOAD offsets at runtime. This is especially bad if -a loaded segment has additional padding that's not in the file offsets. - -Now we do a first scan of the program headers to figure out the runtime -base address based on `PT_PHDR` and/or `PT_DYNAMIC` (else assume zero), -similar to libc's `do_start`. Then each `PT_NOTE` pointer is simply the -base plus the segments's `pt_vaddr`, which includes LOAD offsets. - -Fixes #114605 ---- - .../lib/profile/InstrProfilingPlatformLinux.c | 40 ++++++++----------- - 1 file changed, 16 insertions(+), 24 deletions(-) - -diff --git a/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c b/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c -index e2c06d51e0c6..c365129a0768 100644 ---- a/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c -+++ b/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c -@@ -194,41 +194,33 @@ static int WriteBinaryIds(ProfDataWriter *Writer, const ElfW(Nhdr) * Note, - */ - COMPILER_RT_VISIBILITY int __llvm_write_binary_ids(ProfDataWriter *Writer) { - extern const ElfW(Ehdr) __ehdr_start __attribute__((visibility("hidden"))); -+ extern ElfW(Dyn) _DYNAMIC[] __attribute__((weak, visibility("hidden"))); -+ - const ElfW(Ehdr) *ElfHeader = &__ehdr_start; - const ElfW(Phdr) *ProgramHeader = - (const ElfW(Phdr) *)((uintptr_t)ElfHeader + ElfHeader->e_phoff); - -+ /* Compute the added base address in case of position-independent code. */ -+ uintptr_t Base = 0; -+ for (uint32_t I = 0; I < ElfHeader->e_phnum; I++) { -+ if (ProgramHeader[I].p_type == PT_PHDR) -+ Base = (uintptr_t)ProgramHeader - ProgramHeader[I].p_vaddr; -+ if (ProgramHeader[I].p_type == PT_DYNAMIC && _DYNAMIC) -+ Base = (uintptr_t)_DYNAMIC - ProgramHeader[I].p_vaddr; -+ } -+ - int TotalBinaryIdsSize = 0; -- uint32_t I; - /* Iterate through entries in the program header. */ -- for (I = 0; I < ElfHeader->e_phnum; I++) { -+ for (uint32_t I = 0; I < ElfHeader->e_phnum; I++) { - /* Look for the notes segment in program header entries. */ - if (ProgramHeader[I].p_type != PT_NOTE) - continue; - - /* There can be multiple notes segment, and examine each of them. */ -- const ElfW(Nhdr) * Note; -- const ElfW(Nhdr) * NotesEnd; -- /* -- * When examining notes in file, use p_offset, which is the offset within -- * the elf file, to find the start of notes. -- */ -- if (ProgramHeader[I].p_memsz == 0 || -- ProgramHeader[I].p_memsz == ProgramHeader[I].p_filesz) { -- Note = (const ElfW(Nhdr) *)((uintptr_t)ElfHeader + -- ProgramHeader[I].p_offset); -- NotesEnd = (const ElfW(Nhdr) *)((const char *)(Note) + -- ProgramHeader[I].p_filesz); -- } else { -- /* -- * When examining notes in memory, use p_vaddr, which is the address of -- * section after loaded to memory, to find the start of notes. -- */ -- Note = -- (const ElfW(Nhdr) *)((uintptr_t)ElfHeader + ProgramHeader[I].p_vaddr); -- NotesEnd = -- (const ElfW(Nhdr) *)((const char *)(Note) + ProgramHeader[I].p_memsz); -- } -+ const ElfW(Nhdr) *Note = -+ (const ElfW(Nhdr) *)(Base + ProgramHeader[I].p_vaddr); -+ const ElfW(Nhdr) *NotesEnd = -+ (const ElfW(Nhdr) *)((const char *)(Note) + ProgramHeader[I].p_memsz); - - int BinaryIdsSize = WriteBinaryIds(Writer, Note, NotesEnd); - if (TotalBinaryIdsSize == -1) --- -2.47.0 - diff --git a/SOURCES/0002-BPF-Remove-unused-weak-symbol-__bpf_trap-166003.patch b/SOURCES/0002-BPF-Remove-unused-weak-symbol-__bpf_trap-166003.patch new file mode 100644 index 0000000..0c7e018 --- /dev/null +++ b/SOURCES/0002-BPF-Remove-unused-weak-symbol-__bpf_trap-166003.patch @@ -0,0 +1,130 @@ +From be4fa19ecf95d94d3ef46be183d3d4b4ebb6bb47 Mon Sep 17 00:00:00 2001 +From: yonghong-song +Date: Mon, 3 Nov 2025 11:11:47 -0800 +Subject: [PATCH] [BPF] Remove unused weak symbol __bpf_trap (#166003) + +Nikita Popov reported an issue ([1]) where a dangling weak symbol +__bpf_trap is in the final binary and this caused libbpf failing like +below: + + $ veristat -v ./t.o + Processing 't.o'... + libbpf: elf: skipping unrecognized data section(4) .eh_frame + libbpf: elf: skipping relo section(5) .rel.eh_frame for section(4) .eh_frame + libbpf: failed to find BTF for extern '__bpf_trap': -3 + Failed to open './t.o': -3 + +In llvm, the dag selection phase generates __bpf_trap in code. Later the +UnreachableBlockElim pass removed __bpf_trap from the code, but +__bpf_trap symbol survives in the symbol table. + +Having a dangling __bpf_trap weak symbol is not good for old kernels as +seen in the above veristat failure. Although users could use compiler +flag `-mllvm -bpf-disable-trap-unreachable` to workaround the issue, +this patch fixed the issue by removing the dangling __bpf_trap. + + [1] https://github.com/llvm/llvm-project/issues/165696 + +(cherry picked from commit 8fd1bf2f8c9e6e7c4bc5f6915a9d52bb3672601b) +--- + llvm/lib/Target/BPF/BPFAsmPrinter.cpp | 24 ++++++++++++++++++++ + llvm/lib/Target/BPF/BPFAsmPrinter.h | 1 + + llvm/test/CodeGen/BPF/bpf_trap.ll | 32 +++++++++++++++++++++++++++ + 3 files changed, 57 insertions(+) + create mode 100644 llvm/test/CodeGen/BPF/bpf_trap.ll + +diff --git a/llvm/lib/Target/BPF/BPFAsmPrinter.cpp b/llvm/lib/Target/BPF/BPFAsmPrinter.cpp +index 77dc4a75a7d6..b2a82040ee82 100644 +--- a/llvm/lib/Target/BPF/BPFAsmPrinter.cpp ++++ b/llvm/lib/Target/BPF/BPFAsmPrinter.cpp +@@ -88,6 +88,16 @@ bool BPFAsmPrinter::doFinalization(Module &M) { + } + } + ++ for (GlobalObject &GO : M.global_objects()) { ++ if (!GO.hasExternalWeakLinkage()) ++ continue; ++ ++ if (!SawTrapCall && GO.getName() == BPF_TRAP) { ++ GO.eraseFromParent(); ++ break; ++ } ++ } ++ + return AsmPrinter::doFinalization(M); + } + +@@ -160,6 +170,20 @@ bool BPFAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, + } + + void BPFAsmPrinter::emitInstruction(const MachineInstr *MI) { ++ if (MI->isCall()) { ++ for (const MachineOperand &Op : MI->operands()) { ++ if (Op.isGlobal()) { ++ if (const GlobalValue *GV = Op.getGlobal()) ++ if (GV->getName() == BPF_TRAP) ++ SawTrapCall = true; ++ } else if (Op.isSymbol()) { ++ if (const MCSymbol *Sym = Op.getMCSymbol()) ++ if (Sym->getName() == BPF_TRAP) ++ SawTrapCall = true; ++ } ++ } ++ } ++ + BPF_MC::verifyInstructionPredicates(MI->getOpcode(), + getSubtargetInfo().getFeatureBits()); + +diff --git a/llvm/lib/Target/BPF/BPFAsmPrinter.h b/llvm/lib/Target/BPF/BPFAsmPrinter.h +index 0cfb2839c8ff..60a285ea2b7d 100644 +--- a/llvm/lib/Target/BPF/BPFAsmPrinter.h ++++ b/llvm/lib/Target/BPF/BPFAsmPrinter.h +@@ -39,6 +39,7 @@ public: + private: + BTFDebug *BTF; + TargetMachine &TM; ++ bool SawTrapCall = false; + + const BPFTargetMachine &getBTM() const; + }; +diff --git a/llvm/test/CodeGen/BPF/bpf_trap.ll b/llvm/test/CodeGen/BPF/bpf_trap.ll +new file mode 100644 +index 000000000000..ab8df5ff7cb0 +--- /dev/null ++++ b/llvm/test/CodeGen/BPF/bpf_trap.ll +@@ -0,0 +1,32 @@ ++; RUN: llc < %s | FileCheck %s ++; ++target triple = "bpf" ++ ++define i32 @test(i8 %x) { ++entry: ++ %0 = and i8 %x, 3 ++ switch i8 %0, label %default.unreachable4 [ ++ i8 0, label %return ++ i8 1, label %sw.bb1 ++ i8 2, label %sw.bb2 ++ i8 3, label %sw.bb3 ++ ] ++ ++sw.bb1: ; preds = %entry ++ br label %return ++ ++sw.bb2: ; preds = %entry ++ br label %return ++ ++sw.bb3: ; preds = %entry ++ br label %return ++ ++default.unreachable4: ; preds = %entry ++ unreachable ++ ++return: ; preds = %entry, %sw.bb3, %sw.bb2, %sw.bb1 ++ %retval.0 = phi i32 [ 12, %sw.bb1 ], [ 43, %sw.bb2 ], [ 54, %sw.bb3 ], [ 32, %entry ] ++ ret i32 %retval.0 ++} ++ ++; CHECK-NOT: __bpf_trap +-- +2.50.1 + diff --git a/SOURCES/0003-BPF-Remove-dead-code-related-to-__bpf_trap-global-va.patch b/SOURCES/0003-BPF-Remove-dead-code-related-to-__bpf_trap-global-va.patch new file mode 100644 index 0000000..08de31e --- /dev/null +++ b/SOURCES/0003-BPF-Remove-dead-code-related-to-__bpf_trap-global-va.patch @@ -0,0 +1,34 @@ +From ac5b6151976c70c8b676d3bc6ff82895fe0e1d01 Mon Sep 17 00:00:00 2001 +From: yonghong-song +Date: Tue, 4 Nov 2025 15:15:33 -0800 +Subject: [PATCH] [BPF] Remove dead code related to __bpf_trap global var + (#166440) + +In [1], the symbol __bpf_trap (macro BPF_TRAP) is removed if it is not +used in the code. In the discussion in [1], it is found that the branch +"if (Op.isSymbol())" is actually always false. Remove it to avoid +confusion. + + [1] https://github.com/llvm/llvm-project/pull/166003 +--- + llvm/lib/Target/BPF/BPFAsmPrinter.cpp | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/llvm/lib/Target/BPF/BPFAsmPrinter.cpp b/llvm/lib/Target/BPF/BPFAsmPrinter.cpp +index 378a72ab27dd..abe081c0c76f 100644 +--- a/llvm/lib/Target/BPF/BPFAsmPrinter.cpp ++++ b/llvm/lib/Target/BPF/BPFAsmPrinter.cpp +@@ -176,10 +176,6 @@ void BPFAsmPrinter::emitInstruction(const MachineInstr *MI) { + if (const GlobalValue *GV = Op.getGlobal()) + if (GV->getName() == BPF_TRAP) + SawTrapCall = true; +- } else if (Op.isSymbol()) { +- if (const MCSymbol *Sym = Op.getMCSymbol()) +- if (Sym->getName() == BPF_TRAP) +- SawTrapCall = true; + } + } + } +-- +2.50.1 + diff --git a/SOURCES/18-99273.patch b/SOURCES/18-99273.patch deleted file mode 100644 index bacb46b..0000000 --- a/SOURCES/18-99273.patch +++ /dev/null @@ -1,893 +0,0 @@ -From 91052169960477fbc39169c10f9fae3bec732510 Mon Sep 17 00:00:00 2001 -From: Carl Ritson -Date: Wed, 17 Jul 2024 15:07:42 +0900 -Subject: [PATCH 1/3] [AMDGPU] Implement workaround for GFX11.5 export priority - -On GFX11.5 shaders having completed exports need to execute/wait -at a lower priority than shaders still executing exports. -Add code to maintain normal priority of 2 for shaders that export -and drop to priority 0 after exports. ---- - llvm/lib/Target/AMDGPU/AMDGPU.td | 15 +- - .../lib/Target/AMDGPU/GCNHazardRecognizer.cpp | 112 ++++++ - llvm/lib/Target/AMDGPU/GCNHazardRecognizer.h | 1 + - llvm/lib/Target/AMDGPU/GCNSubtarget.h | 3 + - .../AMDGPU/required-export-priority.ll | 344 ++++++++++++++++++ - .../AMDGPU/required-export-priority.mir | 293 +++++++++++++++ - 6 files changed, 765 insertions(+), 3 deletions(-) - create mode 100644 llvm/test/CodeGen/AMDGPU/required-export-priority.ll - create mode 100644 llvm/test/CodeGen/AMDGPU/required-export-priority.mir - -diff --git a/llvm/lib/Target/AMDGPU/AMDGPU.td b/llvm/lib/Target/AMDGPU/AMDGPU.td -index dfc8eaea66f7b..14fcf6a210a78 100644 ---- a/llvm/lib/Target/AMDGPU/AMDGPU.td -+++ b/llvm/lib/Target/AMDGPU/AMDGPU.td -@@ -947,6 +947,12 @@ def FeatureHasRestrictedSOffset : SubtargetFeature<"restricted-soffset", - "Has restricted SOffset (immediate not supported)." - >; - -+def FeatureRequiredExportPriority : SubtargetFeature<"required-export-priority", -+ "HasRequiredExportPriority", -+ "true", -+ "Export priority must be explicitly manipulated on GFX11.5" -+>; -+ - //===------------------------------------------------------------===// - // Subtarget Features (options and debugging) - //===------------------------------------------------------------===// -@@ -1597,14 +1603,16 @@ def FeatureISAVersion11_5_0 : FeatureSet< - !listconcat(FeatureISAVersion11_Common.Features, - [FeatureSALUFloatInsts, - FeatureDPPSrc1SGPR, -- FeatureVGPRSingleUseHintInsts])>; -+ FeatureVGPRSingleUseHintInsts, -+ FeatureRequiredExportPriority])>; - - def FeatureISAVersion11_5_1 : FeatureSet< - !listconcat(FeatureISAVersion11_Common.Features, - [FeatureSALUFloatInsts, - FeatureDPPSrc1SGPR, - FeatureVGPRSingleUseHintInsts, -- FeatureGFX11FullVGPRs])>; -+ FeatureGFX11FullVGPRs, -+ FeatureRequiredExportPriority])>; - - def FeatureISAVersion12 : FeatureSet< - [FeatureGFX12, -diff --git a/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp b/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp -index a402fc6d7e611..a8b171aa82840 100644 ---- a/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp -+++ b/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp -@@ -14,6 +14,7 @@ - #include "GCNSubtarget.h" - #include "MCTargetDesc/AMDGPUMCTargetDesc.h" - #include "SIMachineFunctionInfo.h" -+#include "llvm/CodeGen/MachineFrameInfo.h" - #include "llvm/CodeGen/MachineFunction.h" - #include "llvm/CodeGen/ScheduleDAG.h" - #include "llvm/TargetParser/TargetParser.h" -@@ -1104,6 +1105,7 @@ void GCNHazardRecognizer::fixHazards(MachineInstr *MI) { - fixWMMAHazards(MI); - fixShift64HighRegBug(MI); - fixVALUMaskWriteHazard(MI); -+ fixRequiredExportPriority(MI); - } - - bool GCNHazardRecognizer::fixVcmpxPermlaneHazards(MachineInstr *MI) { -@@ -2895,3 +2897,113 @@ bool GCNHazardRecognizer::fixVALUMaskWriteHazard(MachineInstr *MI) { - - return true; - } -+ -+static bool ensureEntrySetPrio(MachineFunction *MF, int Priority, -+ const SIInstrInfo &TII) { -+ MachineBasicBlock &EntryMBB = MF->front(); -+ if (EntryMBB.begin() != EntryMBB.end()) { -+ auto &EntryMI = *EntryMBB.begin(); -+ if (EntryMI.getOpcode() == AMDGPU::S_SETPRIO && -+ EntryMI.getOperand(0).getImm() >= Priority) -+ return false; -+ } -+ -+ BuildMI(EntryMBB, EntryMBB.begin(), DebugLoc(), TII.get(AMDGPU::S_SETPRIO)) -+ .addImm(Priority); -+ return true; -+} -+ -+bool GCNHazardRecognizer::fixRequiredExportPriority(MachineInstr *MI) { -+ if (!ST.hasRequiredExportPriority()) -+ return false; -+ -+ // Assume the following shader types will never have exports, -+ // and avoid adding or adjusting S_SETPRIO. -+ MachineBasicBlock *MBB = MI->getParent(); -+ MachineFunction *MF = MBB->getParent(); -+ auto CC = MF->getFunction().getCallingConv(); -+ switch (CC) { -+ case CallingConv::AMDGPU_CS: -+ case CallingConv::AMDGPU_CS_Chain: -+ case CallingConv::AMDGPU_CS_ChainPreserve: -+ case CallingConv::AMDGPU_KERNEL: -+ return false; -+ default: -+ break; -+ } -+ -+ const int MaxPriority = 3; -+ const int NormalPriority = 2; -+ const int PostExportPriority = 0; -+ -+ auto It = MI->getIterator(); -+ switch (MI->getOpcode()) { -+ case AMDGPU::S_ENDPGM: -+ case AMDGPU::S_ENDPGM_SAVED: -+ case AMDGPU::S_ENDPGM_ORDERED_PS_DONE: -+ case AMDGPU::SI_RETURN_TO_EPILOG: -+ // Ensure shader with calls raises priority at entry. -+ // This ensures correct priority if exports exist in callee. -+ if (MF->getFrameInfo().hasCalls()) -+ return ensureEntrySetPrio(MF, NormalPriority, TII); -+ return false; -+ case AMDGPU::S_SETPRIO: { -+ // Raise minimum priority unless in workaround. -+ auto &PrioOp = MI->getOperand(0); -+ int Prio = PrioOp.getImm(); -+ bool InWA = (Prio == PostExportPriority) && -+ (It != MBB->begin() && TII.isEXP(*std::prev(It))); -+ if (InWA || Prio >= NormalPriority) -+ return false; -+ PrioOp.setImm(std::min(Prio + NormalPriority, MaxPriority)); -+ return true; -+ } -+ default: -+ if (!TII.isEXP(*MI)) -+ return false; -+ break; -+ } -+ -+ // Check entry priority at each export (as there will only be a few). -+ // Note: amdgpu_gfx can only be a callee, so defer to caller setprio. -+ bool Changed = false; -+ if (CC != CallingConv::AMDGPU_Gfx) -+ Changed = ensureEntrySetPrio(MF, NormalPriority, TII); -+ -+ auto NextMI = std::next(It); -+ bool EndOfShader = false; -+ if (NextMI != MBB->end()) { -+ // Only need WA at end of sequence of exports. -+ if (TII.isEXP(*NextMI)) -+ return Changed; -+ // Assume appropriate S_SETPRIO after export means WA already applied. -+ if (NextMI->getOpcode() == AMDGPU::S_SETPRIO && -+ NextMI->getOperand(0).getImm() == PostExportPriority) -+ return Changed; -+ EndOfShader = NextMI->getOpcode() == AMDGPU::S_ENDPGM; -+ } -+ -+ const DebugLoc &DL = MI->getDebugLoc(); -+ -+ // Lower priority. -+ BuildMI(*MBB, NextMI, DL, TII.get(AMDGPU::S_SETPRIO)) -+ .addImm(PostExportPriority); -+ -+ if (!EndOfShader) { -+ // Wait for exports to complete. -+ BuildMI(*MBB, NextMI, DL, TII.get(AMDGPU::S_WAITCNT_EXPCNT)) -+ .addReg(AMDGPU::SGPR_NULL) -+ .addImm(0); -+ } -+ -+ BuildMI(*MBB, NextMI, DL, TII.get(AMDGPU::S_NOP)).addImm(0); -+ BuildMI(*MBB, NextMI, DL, TII.get(AMDGPU::S_NOP)).addImm(0); -+ -+ if (!EndOfShader) { -+ // Return to normal (higher) priority. -+ BuildMI(*MBB, NextMI, DL, TII.get(AMDGPU::S_SETPRIO)) -+ .addImm(NormalPriority); -+ } -+ -+ return true; -+} -diff --git a/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.h b/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.h -index 3ccca527c626b..f2a64ab48e180 100644 ---- a/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.h -+++ b/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.h -@@ -107,6 +107,7 @@ class GCNHazardRecognizer final : public ScheduleHazardRecognizer { - bool fixWMMAHazards(MachineInstr *MI); - bool fixShift64HighRegBug(MachineInstr *MI); - bool fixVALUMaskWriteHazard(MachineInstr *MI); -+ bool fixRequiredExportPriority(MachineInstr *MI); - - int checkMAIHazards(MachineInstr *MI); - int checkMAIHazards908(MachineInstr *MI); -diff --git a/llvm/lib/Target/AMDGPU/GCNSubtarget.h b/llvm/lib/Target/AMDGPU/GCNSubtarget.h -index e5817594a4521..def89c785b855 100644 ---- a/llvm/lib/Target/AMDGPU/GCNSubtarget.h -+++ b/llvm/lib/Target/AMDGPU/GCNSubtarget.h -@@ -238,6 +238,7 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo, - bool HasVOPDInsts = false; - bool HasVALUTransUseHazard = false; - bool HasForceStoreSC0SC1 = false; -+ bool HasRequiredExportPriority = false; - - // Dummy feature to use for assembler in tablegen. - bool FeatureDisable = false; -@@ -1282,6 +1283,8 @@ class GCNSubtarget final : public AMDGPUGenSubtargetInfo, - - bool hasRestrictedSOffset() const { return HasRestrictedSOffset; } - -+ bool hasRequiredExportPriority() const { return HasRequiredExportPriority; } -+ - /// \returns true if the target uses LOADcnt/SAMPLEcnt/BVHcnt, DScnt/KMcnt - /// and STOREcnt rather than VMcnt, LGKMcnt and VScnt respectively. - bool hasExtendedWaitCounts() const { return getGeneration() >= GFX12; } -diff --git a/llvm/test/CodeGen/AMDGPU/required-export-priority.ll b/llvm/test/CodeGen/AMDGPU/required-export-priority.ll -new file mode 100644 -index 0000000000000..377902f3f0d1a ---- /dev/null -+++ b/llvm/test/CodeGen/AMDGPU/required-export-priority.ll -@@ -0,0 +1,344 @@ -+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 -+; RUN: llc -mtriple=amdgcn -mcpu=gfx1150 -amdgpu-enable-vopd=0 -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s -+ -+define amdgpu_ps void @test_export_zeroes_f32() #0 { -+; GCN-LABEL: test_export_zeroes_f32: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: v_mov_b32_e32 v0, 0 -+; GCN-NEXT: exp mrt0 off, off, off, off -+; GCN-NEXT: exp mrt0 off, off, off, off done -+; GCN-NEXT: s_setprio 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_endpgm -+ call void @llvm.amdgcn.exp.f32(i32 0, i32 0, float 0.0, float 0.0, float 0.0, float 0.0, i1 false, i1 false) -+ call void @llvm.amdgcn.exp.f32(i32 0, i32 0, float 0.0, float 0.0, float 0.0, float 0.0, i1 true, i1 false) -+ ret void -+} -+ -+define amdgpu_ps void @test_export_en_src0_f32() #0 { -+; GCN-LABEL: test_export_en_src0_f32: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: v_mov_b32_e32 v0, 4.0 -+; GCN-NEXT: v_mov_b32_e32 v1, 0.5 -+; GCN-NEXT: v_mov_b32_e32 v2, 2.0 -+; GCN-NEXT: v_mov_b32_e32 v3, 1.0 -+; GCN-NEXT: exp mrt0 v3, off, off, off done -+; GCN-NEXT: s_setprio 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_endpgm -+ call void @llvm.amdgcn.exp.f32(i32 0, i32 1, float 1.0, float 2.0, float 0.5, float 4.0, i1 true, i1 false) -+ ret void -+} -+ -+define amdgpu_gs void @test_export_gs() #0 { -+; GCN-LABEL: test_export_gs: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: v_mov_b32_e32 v0, 4.0 -+; GCN-NEXT: v_mov_b32_e32 v1, 0.5 -+; GCN-NEXT: v_mov_b32_e32 v2, 2.0 -+; GCN-NEXT: v_mov_b32_e32 v3, 1.0 -+; GCN-NEXT: exp mrt0 off, v2, off, off done -+; GCN-NEXT: s_setprio 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_endpgm -+ call void @llvm.amdgcn.exp.f32(i32 0, i32 2, float 1.0, float 2.0, float 0.5, float 4.0, i1 true, i1 false) -+ ret void -+} -+ -+define amdgpu_hs void @test_export_hs() #0 { -+; GCN-LABEL: test_export_hs: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: v_mov_b32_e32 v0, 4.0 -+; GCN-NEXT: v_mov_b32_e32 v1, 0.5 -+; GCN-NEXT: v_mov_b32_e32 v2, 2.0 -+; GCN-NEXT: v_mov_b32_e32 v3, 1.0 -+; GCN-NEXT: exp mrt0 off, v2, off, off done -+; GCN-NEXT: s_setprio 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_endpgm -+ call void @llvm.amdgcn.exp.f32(i32 0, i32 2, float 1.0, float 2.0, float 0.5, float 4.0, i1 true, i1 false) -+ ret void -+} -+ -+define amdgpu_gfx void @test_export_gfx(float %v) #0 { -+; GCN-LABEL: test_export_gfx: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -+; GCN-NEXT: v_mov_b32_e32 v1, 4.0 -+; GCN-NEXT: v_mov_b32_e32 v2, 0.5 -+; GCN-NEXT: v_mov_b32_e32 v3, 2.0 -+; GCN-NEXT: exp mrt0 off, v3, off, off done -+; GCN-NEXT: s_setprio 0 -+; GCN-NEXT: s_waitcnt_expcnt null, 0x0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: s_waitcnt expcnt(0) -+; GCN-NEXT: s_setpc_b64 s[30:31] -+ call void @llvm.amdgcn.exp.f32(i32 0, i32 2, float %v, float 2.0, float 0.5, float 4.0, i1 true, i1 false) -+ ret void -+} -+ -+define amdgpu_cs void @test_export_cs() #0 { -+; GCN-LABEL: test_export_cs: -+; GCN: ; %bb.0: -+; GCN-NEXT: v_mov_b32_e32 v0, 4.0 -+; GCN-NEXT: v_mov_b32_e32 v1, 0.5 -+; GCN-NEXT: v_mov_b32_e32 v2, 2.0 -+; GCN-NEXT: v_mov_b32_e32 v3, 1.0 -+; GCN-NEXT: exp mrt0 off, v2, off, off done -+; GCN-NEXT: s_endpgm -+ call void @llvm.amdgcn.exp.f32(i32 0, i32 2, float 1.0, float 2.0, float 0.5, float 4.0, i1 true, i1 false) -+ ret void -+} -+ -+define amdgpu_kernel void @test_export_kernel() #0 { -+; GCN-LABEL: test_export_kernel: -+; GCN: ; %bb.0: -+; GCN-NEXT: v_mov_b32_e32 v0, 4.0 -+; GCN-NEXT: v_mov_b32_e32 v1, 0.5 -+; GCN-NEXT: v_mov_b32_e32 v2, 2.0 -+; GCN-NEXT: v_mov_b32_e32 v3, 1.0 -+; GCN-NEXT: exp mrt0 off, v2, off, off done -+; GCN-NEXT: s_endpgm -+ call void @llvm.amdgcn.exp.f32(i32 0, i32 2, float 1.0, float 2.0, float 0.5, float 4.0, i1 true, i1 false) -+ ret void -+} -+ -+define amdgpu_gfx void @test_no_export_gfx(float %v) #0 { -+; GCN-LABEL: test_no_export_gfx: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) -+; GCN-NEXT: s_setpc_b64 s[30:31] -+ ret void -+} -+ -+define amdgpu_ps void @test_no_export_ps(float %v) #0 { -+; GCN-LABEL: test_no_export_ps: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_endpgm -+ ret void -+} -+ -+define amdgpu_ps void @test_if_export_f32(i32 %flag, float %x, float %y, float %z, float %w) #0 { -+; GCN-LABEL: test_if_export_f32: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: s_mov_b32 s0, exec_lo -+; GCN-NEXT: v_cmpx_ne_u32_e32 0, v0 -+; GCN-NEXT: s_cbranch_execz .LBB9_2 -+; GCN-NEXT: ; %bb.1: ; %exp -+; GCN-NEXT: exp mrt0 v1, v2, v3, v4 -+; GCN-NEXT: s_setprio 0 -+; GCN-NEXT: s_waitcnt_expcnt null, 0x0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: .LBB9_2: ; %end -+; GCN-NEXT: s_endpgm -+ %cc = icmp eq i32 %flag, 0 -+ br i1 %cc, label %end, label %exp -+ -+exp: -+ call void @llvm.amdgcn.exp.f32(i32 0, i32 15, float %x, float %y, float %z, float %w, i1 false, i1 false) -+ br label %end -+ -+end: -+ ret void -+} -+ -+define amdgpu_ps void @test_if_export_vm_f32(i32 %flag, float %x, float %y, float %z, float %w) #0 { -+; GCN-LABEL: test_if_export_vm_f32: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: s_mov_b32 s0, exec_lo -+; GCN-NEXT: v_cmpx_ne_u32_e32 0, v0 -+; GCN-NEXT: s_cbranch_execz .LBB10_2 -+; GCN-NEXT: ; %bb.1: ; %exp -+; GCN-NEXT: exp mrt0 v1, v2, v3, v4 -+; GCN-NEXT: s_setprio 0 -+; GCN-NEXT: s_waitcnt_expcnt null, 0x0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: .LBB10_2: ; %end -+; GCN-NEXT: s_endpgm -+ %cc = icmp eq i32 %flag, 0 -+ br i1 %cc, label %end, label %exp -+ -+exp: -+ call void @llvm.amdgcn.exp.f32(i32 0, i32 15, float %x, float %y, float %z, float %w, i1 false, i1 true) -+ br label %end -+ -+end: -+ ret void -+} -+ -+define amdgpu_ps void @test_if_export_done_f32(i32 %flag, float %x, float %y, float %z, float %w) #0 { -+; GCN-LABEL: test_if_export_done_f32: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: s_mov_b32 s0, exec_lo -+; GCN-NEXT: v_cmpx_ne_u32_e32 0, v0 -+; GCN-NEXT: s_cbranch_execz .LBB11_2 -+; GCN-NEXT: ; %bb.1: ; %exp -+; GCN-NEXT: exp mrt0 v1, v2, v3, v4 done -+; GCN-NEXT: s_setprio 0 -+; GCN-NEXT: s_waitcnt_expcnt null, 0x0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: .LBB11_2: ; %end -+; GCN-NEXT: s_endpgm -+ %cc = icmp eq i32 %flag, 0 -+ br i1 %cc, label %end, label %exp -+ -+exp: -+ call void @llvm.amdgcn.exp.f32(i32 0, i32 15, float %x, float %y, float %z, float %w, i1 true, i1 false) -+ br label %end -+ -+end: -+ ret void -+} -+ -+define amdgpu_ps void @test_if_export_vm_done_f32(i32 %flag, float %x, float %y, float %z, float %w) #0 { -+; GCN-LABEL: test_if_export_vm_done_f32: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: s_mov_b32 s0, exec_lo -+; GCN-NEXT: v_cmpx_ne_u32_e32 0, v0 -+; GCN-NEXT: s_cbranch_execz .LBB12_2 -+; GCN-NEXT: ; %bb.1: ; %exp -+; GCN-NEXT: exp mrt0 v1, v2, v3, v4 done -+; GCN-NEXT: s_setprio 0 -+; GCN-NEXT: s_waitcnt_expcnt null, 0x0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: .LBB12_2: ; %end -+; GCN-NEXT: s_endpgm -+ %cc = icmp eq i32 %flag, 0 -+ br i1 %cc, label %end, label %exp -+ -+exp: -+ call void @llvm.amdgcn.exp.f32(i32 0, i32 15, float %x, float %y, float %z, float %w, i1 true, i1 true) -+ br label %end -+ -+end: -+ ret void -+} -+ -+define amdgpu_ps void @test_export_pos_before_param_across_load(i32 %idx) #0 { -+; GCN-LABEL: test_export_pos_before_param_across_load: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: buffer_load_b32 v0, v0, s[0:3], 0 offen -+; GCN-NEXT: v_mov_b32_e32 v1, 0 -+; GCN-NEXT: v_mov_b32_e32 v2, 1.0 -+; GCN-NEXT: v_mov_b32_e32 v3, 0.5 -+; GCN-NEXT: s_waitcnt vmcnt(0) -+; GCN-NEXT: exp pos0 v1, v1, v1, v0 done -+; GCN-NEXT: exp invalid_target_32 v2, v2, v2, v2 -+; GCN-NEXT: exp invalid_target_33 v2, v2, v2, v3 -+; GCN-NEXT: s_setprio 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_endpgm -+ call void @llvm.amdgcn.exp.f32(i32 32, i32 15, float 1.0, float 1.0, float 1.0, float 1.0, i1 false, i1 false) -+ call void @llvm.amdgcn.exp.f32(i32 33, i32 15, float 1.0, float 1.0, float 1.0, float 0.5, i1 false, i1 false) -+ %load = call float @llvm.amdgcn.raw.ptr.buffer.load.f32(ptr addrspace(8) undef, i32 %idx, i32 0, i32 0) -+ call void @llvm.amdgcn.exp.f32(i32 12, i32 15, float 0.0, float 0.0, float 0.0, float %load, i1 true, i1 false) -+ ret void -+} -+ -+define amdgpu_ps void @test_export_across_store_load(i32 %idx, float %v) #0 { -+; GCN-LABEL: test_export_across_store_load: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: v_mov_b32_e32 v2, 24 -+; GCN-NEXT: v_cmp_eq_u32_e32 vcc_lo, 1, v0 -+; GCN-NEXT: s_delay_alu instid0(VALU_DEP_2) -+; GCN-NEXT: v_cndmask_b32_e64 v0, v2, 8, vcc_lo -+; GCN-NEXT: v_mov_b32_e32 v2, 0 -+; GCN-NEXT: scratch_store_b32 v0, v1, off -+; GCN-NEXT: scratch_load_b32 v0, off, off -+; GCN-NEXT: v_mov_b32_e32 v1, 1.0 -+; GCN-NEXT: exp pos0 v2, v2, v2, v1 done -+; GCN-NEXT: s_setprio 0 -+; GCN-NEXT: s_waitcnt_expcnt null, 0x0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: s_waitcnt vmcnt(0) -+; GCN-NEXT: exp invalid_target_32 v0, v2, v1, v2 -+; GCN-NEXT: exp invalid_target_33 v0, v2, v1, v2 -+; GCN-NEXT: s_setprio 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_nop 0 -+; GCN-NEXT: s_endpgm -+ %data0 = alloca <4 x float>, align 8, addrspace(5) -+ %data1 = alloca <4 x float>, align 8, addrspace(5) -+ %cmp = icmp eq i32 %idx, 1 -+ %data = select i1 %cmp, ptr addrspace(5) %data0, ptr addrspace(5) %data1 -+ store float %v, ptr addrspace(5) %data, align 8 -+ call void @llvm.amdgcn.exp.f32(i32 12, i32 15, float 0.0, float 0.0, float 0.0, float 1.0, i1 true, i1 false) -+ %load0 = load float, ptr addrspace(5) %data0, align 8 -+ call void @llvm.amdgcn.exp.f32(i32 32, i32 15, float %load0, float 0.0, float 1.0, float 0.0, i1 false, i1 false) -+ call void @llvm.amdgcn.exp.f32(i32 33, i32 15, float %load0, float 0.0, float 1.0, float 0.0, i1 false, i1 false) -+ ret void -+} -+ -+define amdgpu_ps void @test_export_in_callee(float %v) #0 { -+; GCN-LABEL: test_export_in_callee: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: s_getpc_b64 s[0:1] -+; GCN-NEXT: s_add_u32 s0, s0, test_export_gfx@gotpcrel32@lo+4 -+; GCN-NEXT: s_addc_u32 s1, s1, test_export_gfx@gotpcrel32@hi+12 -+; GCN-NEXT: v_add_f32_e32 v0, 1.0, v0 -+; GCN-NEXT: s_load_b64 s[0:1], s[0:1], 0x0 -+; GCN-NEXT: s_mov_b32 s32, 0 -+; GCN-NEXT: s_waitcnt lgkmcnt(0) -+; GCN-NEXT: s_swappc_b64 s[30:31], s[0:1] -+; GCN-NEXT: s_endpgm -+ %x = fadd float %v, 1.0 -+ call void @test_export_gfx(float %x) -+ ret void -+} -+ -+define amdgpu_ps void @test_export_in_callee_prio(float %v) #0 { -+; GCN-LABEL: test_export_in_callee_prio: -+; GCN: ; %bb.0: -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: s_mov_b32 s32, 0 -+; GCN-NEXT: v_add_f32_e32 v0, 1.0, v0 -+; GCN-NEXT: s_setprio 2 -+; GCN-NEXT: s_getpc_b64 s[0:1] -+; GCN-NEXT: s_add_u32 s0, s0, test_export_gfx@gotpcrel32@lo+4 -+; GCN-NEXT: s_addc_u32 s1, s1, test_export_gfx@gotpcrel32@hi+12 -+; GCN-NEXT: s_load_b64 s[0:1], s[0:1], 0x0 -+; GCN-NEXT: s_waitcnt lgkmcnt(0) -+; GCN-NEXT: s_swappc_b64 s[30:31], s[0:1] -+; GCN-NEXT: s_endpgm -+ %x = fadd float %v, 1.0 -+ call void @llvm.amdgcn.s.setprio(i16 0) -+ call void @test_export_gfx(float %x) -+ ret void -+} -+ -+declare void @llvm.amdgcn.exp.f32(i32, i32, float, float, float, float, i1, i1) #1 -+declare void @llvm.amdgcn.exp.i32(i32, i32, i32, i32, i32, i32, i1, i1) #1 -+declare float @llvm.amdgcn.raw.ptr.buffer.load.f32(ptr addrspace(8), i32, i32, i32) #2 -+declare void @llvm.amdgcn.s.setprio(i16) -+ -+attributes #0 = { nounwind } -+attributes #1 = { nounwind inaccessiblememonly } -+attributes #2 = { nounwind readnone } -diff --git a/llvm/test/CodeGen/AMDGPU/required-export-priority.mir b/llvm/test/CodeGen/AMDGPU/required-export-priority.mir -new file mode 100644 -index 0000000000000..eee04468036e5 ---- /dev/null -+++ b/llvm/test/CodeGen/AMDGPU/required-export-priority.mir -@@ -0,0 +1,293 @@ -+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5 -+# RUN: llc -mtriple=amdgcn -mcpu=gfx1150 -mattr=-wavefrontsize32,+wavefrontsize64 -run-pass=post-RA-hazard-rec -verify-machineinstrs %s -o - | FileCheck -check-prefixes=GFX1150 %s -+ -+--- | -+ define amdgpu_ps void @end_of_shader() { -+ ret void -+ } -+ define amdgpu_ps void @end_of_shader_return_to_epilogue() { -+ ret void -+ } -+ define amdgpu_ps void @end_of_block() { -+ ret void -+ } -+ define amdgpu_ps void @start_of_block() { -+ ret void -+ } -+ define amdgpu_ps void @block_of_exports() { -+ ret void -+ } -+ define amdgpu_ps void @sparse_exports() { -+ ret void -+ } -+ define amdgpu_ps void @existing_setprio_1() { -+ ret void -+ } -+ define amdgpu_ps void @existing_setprio_2() { -+ ret void -+ } -+... -+ -+--- -+name: end_of_shader -+tracksRegLiveness: true -+liveins: -+ - { reg: '$vgpr0' } -+body: | -+ bb.0: -+ liveins: $vgpr0 -+ ; GFX1150-LABEL: name: end_of_shader -+ ; GFX1150: liveins: $vgpr0 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ ; GFX1150-NEXT: S_SETPRIO 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_ENDPGM 0 -+ EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ S_ENDPGM 0 -+... -+ -+--- -+name: end_of_shader_return_to_epilogue -+tracksRegLiveness: true -+liveins: -+ - { reg: '$vgpr0' } -+body: | -+ bb.0: -+ liveins: $vgpr0 -+ ; GFX1150-LABEL: name: end_of_shader_return_to_epilogue -+ ; GFX1150: liveins: $vgpr0 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ ; GFX1150-NEXT: S_SETPRIO 0 -+ ; GFX1150-NEXT: S_WAITCNT_EXPCNT $sgpr_null, 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: SI_RETURN_TO_EPILOG $vgpr0 -+ EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ SI_RETURN_TO_EPILOG $vgpr0 -+... -+ -+--- -+name: end_of_block -+tracksRegLiveness: true -+liveins: -+ - { reg: '$vgpr0' } -+body: | -+ ; GFX1150-LABEL: name: end_of_block -+ ; GFX1150: bb.0: -+ ; GFX1150-NEXT: successors: %bb.1(0x80000000) -+ ; GFX1150-NEXT: liveins: $vgpr0 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ ; GFX1150-NEXT: S_SETPRIO 0 -+ ; GFX1150-NEXT: S_WAITCNT_EXPCNT $sgpr_null, 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: bb.1: -+ ; GFX1150-NEXT: S_ENDPGM 0 -+ bb.0: -+ liveins: $vgpr0 -+ EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ -+ bb.1: -+ S_ENDPGM 0 -+... -+ -+--- -+name: start_of_block -+tracksRegLiveness: true -+liveins: -+ - { reg: '$vgpr0' } -+body: | -+ ; GFX1150-LABEL: name: start_of_block -+ ; GFX1150: bb.0: -+ ; GFX1150-NEXT: successors: %bb.1(0x80000000) -+ ; GFX1150-NEXT: liveins: $vgpr0 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: bb.1: -+ ; GFX1150-NEXT: successors: %bb.2(0x80000000) -+ ; GFX1150-NEXT: liveins: $vgpr0 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ ; GFX1150-NEXT: S_SETPRIO 0 -+ ; GFX1150-NEXT: S_WAITCNT_EXPCNT $sgpr_null, 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: bb.2: -+ ; GFX1150-NEXT: S_ENDPGM 0 -+ bb.0: -+ liveins: $vgpr0 -+ -+ bb.1: -+ liveins: $vgpr0 -+ EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ -+ bb.2: -+ S_ENDPGM 0 -+... -+ -+--- -+name: block_of_exports -+tracksRegLiveness: true -+liveins: -+ - { reg: '$vgpr0' } -+body: | -+ bb.0: -+ liveins: $vgpr0 -+ ; GFX1150-LABEL: name: block_of_exports -+ ; GFX1150: liveins: $vgpr0 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: EXP 2, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ ; GFX1150-NEXT: EXP 1, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ ; GFX1150-NEXT: EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ ; GFX1150-NEXT: S_SETPRIO 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_ENDPGM 0 -+ EXP 2, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ EXP 1, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ S_ENDPGM 0 -+... -+ -+--- -+name: sparse_exports -+tracksRegLiveness: true -+liveins: -+ - { reg: '$vgpr0' } -+body: | -+ bb.0: -+ liveins: $vgpr0 -+ ; GFX1150-LABEL: name: sparse_exports -+ ; GFX1150: liveins: $vgpr0 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: EXP 2, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ ; GFX1150-NEXT: S_SETPRIO 0 -+ ; GFX1150-NEXT: S_WAITCNT_EXPCNT $sgpr_null, 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: $vgpr0 = V_AND_B32_e32 1, $vgpr0, implicit $exec -+ ; GFX1150-NEXT: EXP 1, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ ; GFX1150-NEXT: S_SETPRIO 0 -+ ; GFX1150-NEXT: S_WAITCNT_EXPCNT $sgpr_null, 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: $vgpr0 = V_OR_B32_e32 2, $vgpr0, implicit $exec -+ ; GFX1150-NEXT: EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ ; GFX1150-NEXT: S_SETPRIO 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_ENDPGM 0 -+ EXP 2, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ $vgpr0 = V_AND_B32_e32 1, $vgpr0, implicit $exec -+ EXP 1, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ $vgpr0 = V_OR_B32_e32 2, $vgpr0, implicit $exec -+ EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ S_ENDPGM 0 -+... -+ -+--- -+name: existing_setprio_1 -+tracksRegLiveness: true -+liveins: -+ - { reg: '$vgpr0' } -+body: | -+ ; GFX1150-LABEL: name: existing_setprio_1 -+ ; GFX1150: bb.0: -+ ; GFX1150-NEXT: successors: %bb.1(0x80000000) -+ ; GFX1150-NEXT: liveins: $vgpr0 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: $vgpr0 = V_AND_B32_e32 1, $vgpr0, implicit $exec -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: bb.1: -+ ; GFX1150-NEXT: successors: %bb.2(0x80000000) -+ ; GFX1150-NEXT: liveins: $vgpr0 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: S_SETPRIO 3 -+ ; GFX1150-NEXT: $vgpr0 = V_OR_B32_e32 2, $vgpr0, implicit $exec -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: bb.2: -+ ; GFX1150-NEXT: successors: %bb.3(0x80000000) -+ ; GFX1150-NEXT: liveins: $vgpr0 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: S_SETPRIO 3 -+ ; GFX1150-NEXT: $vgpr0 = V_OR_B32_e32 3, $vgpr0, implicit $exec -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: bb.3: -+ ; GFX1150-NEXT: liveins: $vgpr0 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: EXP 1, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ ; GFX1150-NEXT: EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ ; GFX1150-NEXT: S_SETPRIO 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_ENDPGM 0 -+ bb.0: -+ liveins: $vgpr0 -+ $vgpr0 = V_AND_B32_e32 1, $vgpr0, implicit $exec -+ -+ bb.1: -+ liveins: $vgpr0 -+ S_SETPRIO 3 -+ $vgpr0 = V_OR_B32_e32 2, $vgpr0, implicit $exec -+ S_SETPRIO 0 -+ -+ bb.2: -+ liveins: $vgpr0 -+ S_SETPRIO 1 -+ $vgpr0 = V_OR_B32_e32 3, $vgpr0, implicit $exec -+ S_SETPRIO 0 -+ -+ bb.3: -+ liveins: $vgpr0 -+ EXP 1, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ S_ENDPGM 0 -+... -+ -+--- -+name: existing_setprio_2 -+tracksRegLiveness: true -+liveins: -+ - { reg: '$vgpr0' } -+body: | -+ bb.0: -+ liveins: $vgpr0 -+ ; GFX1150-LABEL: name: existing_setprio_2 -+ ; GFX1150: liveins: $vgpr0 -+ ; GFX1150-NEXT: {{ $}} -+ ; GFX1150-NEXT: S_SETPRIO 3 -+ ; GFX1150-NEXT: EXP 1, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ ; GFX1150-NEXT: EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ ; GFX1150-NEXT: S_SETPRIO 0 -+ ; GFX1150-NEXT: S_WAITCNT_EXPCNT $sgpr_null, 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_NOP 0 -+ ; GFX1150-NEXT: S_SETPRIO 2 -+ ; GFX1150-NEXT: S_SETPRIO 3 -+ ; GFX1150-NEXT: S_ENDPGM 0 -+ S_SETPRIO 3 -+ EXP 1, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ EXP_DONE 0, $vgpr0, $vgpr0, $vgpr0, $vgpr0, -1, -1, 15, implicit $exec -+ S_SETPRIO 3 -+ S_ENDPGM 0 -+... - -From 8ea44e65f2c19facff751aeb2ac960f907fb210f Mon Sep 17 00:00:00 2001 -From: Carl Ritson -Date: Wed, 17 Jul 2024 16:18:02 +0900 -Subject: [PATCH 2/3] Remove -verify-machineinstrs from test. - ---- - llvm/test/CodeGen/AMDGPU/required-export-priority.ll | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/llvm/test/CodeGen/AMDGPU/required-export-priority.ll b/llvm/test/CodeGen/AMDGPU/required-export-priority.ll -index 377902f3f0d1a..ebc209bd4d451 100644 ---- a/llvm/test/CodeGen/AMDGPU/required-export-priority.ll -+++ b/llvm/test/CodeGen/AMDGPU/required-export-priority.ll -@@ -1,5 +1,5 @@ - ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 --; RUN: llc -mtriple=amdgcn -mcpu=gfx1150 -amdgpu-enable-vopd=0 -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s -+; RUN: llc -mtriple=amdgcn -mcpu=gfx1150 -amdgpu-enable-vopd=0 < %s | FileCheck -check-prefix=GCN %s - - define amdgpu_ps void @test_export_zeroes_f32() #0 { - ; GCN-LABEL: test_export_zeroes_f32: diff --git a/SOURCES/20-131099.patch b/SOURCES/20-131099.patch new file mode 100644 index 0000000..0b66256 --- /dev/null +++ b/SOURCES/20-131099.patch @@ -0,0 +1,28 @@ +From e43271ec7438ecb78f99db134aeca274a47f6c28 Mon Sep 17 00:00:00 2001 +From: Konrad Kleine +Date: Thu, 13 Mar 2025 09:12:24 +0100 +Subject: [PATCH] Filter out configuration file from compile commands + +The commands to run the compilation when printed with `-###` contain +various irrelevant lines for the perf-training. Most of them are +filtered out already but when configured with +`CLANG_CONFIG_FILE_SYSTEM_DIR` a new line like the following is +added and needs to be filtered out: + +`Configuration file: /etc/clang/x86_64-redhat-linux-gnu-clang.cfg` +--- + clang/utils/perf-training/perf-helper.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/clang/utils/perf-training/perf-helper.py b/clang/utils/perf-training/perf-helper.py +index 80c6356d0497c..29904aded5ab0 100644 +--- a/clang/utils/perf-training/perf-helper.py ++++ b/clang/utils/perf-training/perf-helper.py +@@ -237,6 +237,7 @@ def get_cc1_command_for_args(cmd, env): + or ln.startswith("InstalledDir:") + or ln.startswith("LLVM Profile Note") + or ln.startswith(" (in-process)") ++ or ln.startswith("Configuration file:") + or " version " in ln + ): + continue diff --git a/SOURCES/21-146424.patch b/SOURCES/21-146424.patch new file mode 100644 index 0000000..5b95886 --- /dev/null +++ b/SOURCES/21-146424.patch @@ -0,0 +1,94 @@ +From eba58195932f37fb461ae17c69fc517181b99c9a Mon Sep 17 00:00:00 2001 +From: Paul Murphy +Date: Mon, 30 Jun 2025 10:13:37 -0500 +Subject: [PATCH] [PowerPC] fix lowering of SPILL_CRBIT on pwr9 and pwr10 + +If a copy exists between creation of a crbit and a spill, machine-cp +may delete the copy since it seems unaware of the relation between a cr +and crbit. A fix was previously made for the generic ppc64 lowering. It +should be applied to the pwr9 and pwr10 variants too. + +Likewise, relax and extend the pwr8 test to verify pwr9 and pwr10 +codegen too. + +This fixes #143989. +--- + llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp | 17 +++++++++++------ + .../PowerPC/NoCRFieldRedefWhenSpillingCRBIT.mir | 8 +++++++- + 2 files changed, 18 insertions(+), 7 deletions(-) + +diff --git a/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp b/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp +index 76dca4794e05..78d254a55fd9 100644 +--- a/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp ++++ b/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp +@@ -1102,13 +1102,20 @@ void PPCRegisterInfo::lowerCRBitSpilling(MachineBasicBlock::iterator II, + SpillsKnownBit = true; + break; + default: ++ // When spilling a CR bit, The super register may not be explicitly defined ++ // (i.e. it can be defined by a CR-logical that only defines the subreg) so ++ // we state that the CR field is undef. Also, in order to preserve the kill ++ // flag on the CR bit, we add it as an implicit use. ++ + // On Power10, we can use SETNBC to spill all CR bits. SETNBC will set all + // bits (specifically, it produces a -1 if the CR bit is set). Ultimately, + // the bit that is of importance to us is bit 32 (bit 0 of a 32-bit + // register), and SETNBC will set this. + if (Subtarget.isISA3_1()) { + BuildMI(MBB, II, dl, TII.get(LP64 ? PPC::SETNBC8 : PPC::SETNBC), Reg) +- .addReg(SrcReg, RegState::Undef); ++ .addReg(SrcReg, RegState::Undef) ++ .addReg(SrcReg, RegState::Implicit | ++ getKillRegState(MI.getOperand(0).isKill())); + break; + } + +@@ -1122,16 +1129,14 @@ void PPCRegisterInfo::lowerCRBitSpilling(MachineBasicBlock::iterator II, + SrcReg == PPC::CR4LT || SrcReg == PPC::CR5LT || + SrcReg == PPC::CR6LT || SrcReg == PPC::CR7LT) { + BuildMI(MBB, II, dl, TII.get(LP64 ? PPC::SETB8 : PPC::SETB), Reg) +- .addReg(getCRFromCRBit(SrcReg), RegState::Undef); ++ .addReg(getCRFromCRBit(SrcReg), RegState::Undef) ++ .addReg(SrcReg, RegState::Implicit | ++ getKillRegState(MI.getOperand(0).isKill())); + break; + } + } + + // We need to move the CR field that contains the CR bit we are spilling. +- // The super register may not be explicitly defined (i.e. it can be defined +- // by a CR-logical that only defines the subreg) so we state that the CR +- // field is undef. Also, in order to preserve the kill flag on the CR bit, +- // we add it as an implicit use. + BuildMI(MBB, II, dl, TII.get(LP64 ? PPC::MFOCRF8 : PPC::MFOCRF), Reg) + .addReg(getCRFromCRBit(SrcReg), RegState::Undef) + .addReg(SrcReg, +diff --git a/llvm/test/CodeGen/PowerPC/NoCRFieldRedefWhenSpillingCRBIT.mir b/llvm/test/CodeGen/PowerPC/NoCRFieldRedefWhenSpillingCRBIT.mir +index 41e21248a3f0..2796cdb3ae87 100644 +--- a/llvm/test/CodeGen/PowerPC/NoCRFieldRedefWhenSpillingCRBIT.mir ++++ b/llvm/test/CodeGen/PowerPC/NoCRFieldRedefWhenSpillingCRBIT.mir +@@ -1,6 +1,12 @@ + # RUN: llc -mcpu=pwr8 -mtriple=powerpc64le-unknown-linux-gnu -start-after \ + # RUN: virtregrewriter -ppc-asm-full-reg-names -verify-machineinstrs %s \ + # RUN: -o - | FileCheck %s ++# RUN: llc -mcpu=pwr9 -mtriple=powerpc64le-unknown-linux-gnu -start-after \ ++# RUN: virtregrewriter -ppc-asm-full-reg-names -verify-machineinstrs %s \ ++# RUN: -o - | FileCheck %s ++# RUN: llc -mcpu=pwr10 -mtriple=powerpc64le-unknown-linux-gnu -start-after \ ++# RUN: virtregrewriter -ppc-asm-full-reg-names -verify-machineinstrs %s \ ++# RUN: -o - | FileCheck %s + + --- | + ; ModuleID = 'a.ll' +@@ -30,7 +36,7 @@ + ; Function Attrs: nounwind + declare void @llvm.stackprotector(ptr, ptr) #1 + +- attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="ppc64le" "target-features"="+altivec,+bpermd,+crypto,+direct-move,+extdiv,+htm,+power8-vector,+vsx,-power9-vector" "unsafe-fp-math"="false" "use-soft-float"="false" } ++ attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } + attributes #1 = { nounwind } + + !llvm.ident = !{!0} +-- +2.49.0 + diff --git a/SOURCES/43cb4631c1f42dbfce78288b8ae30b5840ed59b3.patch b/SOURCES/43cb4631c1f42dbfce78288b8ae30b5840ed59b3.patch new file mode 100644 index 0000000..47b333b --- /dev/null +++ b/SOURCES/43cb4631c1f42dbfce78288b8ae30b5840ed59b3.patch @@ -0,0 +1,276 @@ +From 43cb4631c1f42dbfce78288b8ae30b5840ed59b3 Mon Sep 17 00:00:00 2001 +From: Ebuka Ezike +Date: Thu, 8 Jan 2026 18:46:03 +0000 +Subject: [PATCH] [lldb] Fix typed commands not shown on the screen (#174216) + +The cause is that in `python3.14`, `fcntl.ioctl` now throws a buffer +overflow error +when the buffer is too small or too large (see +https://github.com/python/cpython/pull/132919). This caused the Python +interpreter to fail terminal detection and not properly echo user +commands back to the screen. + +Fix by dropping the custom terminal size check entirely and using the +built-in `sys.stdin.isatty()` instead. + +Fixes #173302 +--- + .../Python/lldbsuite/test/lldbpexpect.py | 1 + + .../Interpreter/embedded_interpreter.py | 59 +++--------------- + .../python_api/file_handle/TestFileHandle.py | 48 +++++++++++++- + .../API/terminal/TestPythonInterpreterEcho.py | 62 +++++++++++++++++++ + .../Shell/ScriptInterpreter/Python/io.test | 12 ++++ + 5 files changed, 131 insertions(+), 51 deletions(-) + create mode 100644 lldb/test/API/terminal/TestPythonInterpreterEcho.py + create mode 100644 lldb/test/Shell/ScriptInterpreter/Python/io.test + +diff --git a/lldb/packages/Python/lldbsuite/test/lldbpexpect.py b/lldb/packages/Python/lldbsuite/test/lldbpexpect.py +index 3279e1fd39f8c..03b2500fbda52 100644 +--- a/lldb/packages/Python/lldbsuite/test/lldbpexpect.py ++++ b/lldb/packages/Python/lldbsuite/test/lldbpexpect.py +@@ -10,6 +10,7 @@ + + + @skipIfRemote ++@skipIfWindows + @add_test_categories(["pexpect"]) + class PExpectTest(TestBase): + NO_DEBUG_INFO_TESTCASE = True +diff --git a/lldb/source/Interpreter/embedded_interpreter.py b/lldb/source/Interpreter/embedded_interpreter.py +index 42a9ab5fc367a..12c47bd712816 100644 +--- a/lldb/source/Interpreter/embedded_interpreter.py ++++ b/lldb/source/Interpreter/embedded_interpreter.py +@@ -32,18 +32,6 @@ def is_libedit(): + g_run_one_line_str = None + + +-def get_terminal_size(fd): +- try: +- import fcntl +- import termios +- import struct +- +- hw = struct.unpack("hh", fcntl.ioctl(fd, termios.TIOCGWINSZ, "1234")) +- except: +- hw = (0, 0) +- return hw +- +- + class LLDBExit(SystemExit): + pass + +@@ -74,50 +62,21 @@ def readfunc_stdio(prompt): + def run_python_interpreter(local_dict): + # Pass in the dictionary, for continuity from one session to the next. + try: +- fd = sys.stdin.fileno() +- interacted = False +- if get_terminal_size(fd)[1] == 0: +- try: +- import termios +- +- old = termios.tcgetattr(fd) +- if old[3] & termios.ECHO: +- # Need to turn off echoing and restore +- new = termios.tcgetattr(fd) +- new[3] = new[3] & ~termios.ECHO +- try: +- termios.tcsetattr(fd, termios.TCSADRAIN, new) +- interacted = True +- code.interact( +- banner="Python Interactive Interpreter. To exit, type 'quit()', 'exit()'.", +- readfunc=readfunc_stdio, +- local=local_dict, +- ) +- finally: +- termios.tcsetattr(fd, termios.TCSADRAIN, old) +- except: +- pass +- # Don't need to turn off echoing +- if not interacted: +- code.interact( +- banner="Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.", +- readfunc=readfunc_stdio, +- local=local_dict, +- ) +- else: +- # We have a real interactive terminal +- code.interact( +- banner="Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.", +- readfunc=readfunc, +- local=local_dict, +- ) ++ banner = "Python Interactive Interpreter. To exit, type 'quit()', 'exit()'." ++ input_func = readfunc_stdio ++ ++ is_atty = sys.stdin.isatty() ++ if is_atty: ++ banner = "Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D." ++ input_func = readfunc ++ ++ code.interact(banner=banner, readfunc=input_func, local=local_dict) + except LLDBExit: + pass + except SystemExit as e: + if e.code: + print("Script exited with code %s" % e.code) + +- + def run_one_line(local_dict, input_string): + global g_run_one_line_str + try: +diff --git a/lldb/test/API/python_api/file_handle/TestFileHandle.py b/lldb/test/API/python_api/file_handle/TestFileHandle.py +index b38585577f6f6..707044a3afb0f 100644 +--- a/lldb/test/API/python_api/file_handle/TestFileHandle.py ++++ b/lldb/test/API/python_api/file_handle/TestFileHandle.py +@@ -111,10 +111,11 @@ def setUp(self): + super(FileHandleTestCase, self).setUp() + self.out_filename = self.getBuildArtifact("output") + self.in_filename = self.getBuildArtifact("input") ++ self.err_filename = self.getBuildArtifact("error") + + def tearDown(self): + super(FileHandleTestCase, self).tearDown() +- for name in (self.out_filename, self.in_filename): ++ for name in (self.out_filename, self.in_filename, self.err_filename): + if os.path.exists(name): + os.unlink(name) + +@@ -679,6 +680,51 @@ def test_stdout_file(self): + lines = [x for x in f.read().strip().split() if x != "7"] + self.assertEqual(lines, ["foobar"]) + ++ def test_stdout_file_interactive(self): ++ """Ensure when we read stdin from a file, outputs from python goes to the right I/O stream.""" ++ with open(self.in_filename, "w") as f: ++ f.write( ++ "script --language python --\nvalue = 250 + 5\nprint(value)\nprint(vel)" ++ ) ++ ++ with open(self.out_filename, "w") as outf, open( ++ self.in_filename, "r" ++ ) as inf, open(self.err_filename, "w") as errf: ++ status = self.dbg.SetOutputFile(lldb.SBFile(outf)) ++ self.assertSuccess(status) ++ status = self.dbg.SetErrorFile(lldb.SBFile(errf)) ++ self.assertSuccess(status) ++ status = self.dbg.SetInputFile(lldb.SBFile(inf)) ++ self.assertSuccess(status) ++ auto_handle_events = True ++ spawn_thread = False ++ num_errs = 0 ++ quit_requested = False ++ stopped_for_crash = False ++ opts = lldb.SBCommandInterpreterRunOptions() ++ self.dbg.RunCommandInterpreter( ++ auto_handle_events, ++ spawn_thread, ++ opts, ++ num_errs, ++ quit_requested, ++ stopped_for_crash, ++ ) ++ self.dbg.GetOutputFile().Flush() ++ expected_out_text = "255" ++ expected_err_text = "NameError" ++ # check stdout ++ with open(self.out_filename, "r") as f: ++ out_text = f.read() ++ self.assertIn(expected_out_text, out_text) ++ self.assertNotIn(expected_err_text, out_text) ++ ++ # check stderr ++ with open(self.err_filename, "r") as f: ++ err_text = f.read() ++ self.assertIn(expected_err_text, err_text) ++ self.assertNotIn(expected_out_text, err_text) ++ + def test_identity(self): + f = io.StringIO() + sbf = lldb.SBFile(f) +diff --git a/lldb/test/API/terminal/TestPythonInterpreterEcho.py b/lldb/test/API/terminal/TestPythonInterpreterEcho.py +new file mode 100644 +index 0000000000000..758a4f9cede5a +--- /dev/null ++++ b/lldb/test/API/terminal/TestPythonInterpreterEcho.py +@@ -0,0 +1,62 @@ ++""" ++Test that typing python expression in the terminal is echoed back to stdout. ++""" ++ ++from lldbsuite.test.decorators import skipIfAsan ++from lldbsuite.test.lldbpexpect import PExpectTest ++ ++ ++@skipIfAsan ++class PythonInterpreterEchoTest(PExpectTest): ++ PYTHON_PROMPT = ">>> " ++ ++ def verify_command_echo( ++ self, command: str, expected_output: str = "", is_regex: bool = False ++ ): ++ assert self.child != None ++ child = self.child ++ self.assertIsNotNone(self.child, "expected a running lldb process.") ++ ++ child.sendline(command) ++ ++ # Build pattern list: match whichever comes first (output or prompt). ++ # This prevents waiting for a timeout if there's no match. ++ pattern = [] ++ match_expected = expected_output and len(expected_output) > 0 ++ ++ if match_expected: ++ pattern.append(expected_output) ++ pattern.append(self.PYTHON_PROMPT) ++ ++ expect_func = child.expect if is_regex else child.expect_exact ++ match_idx = expect_func(pattern) ++ if match_expected: ++ self.assertEqual( ++ match_idx, 0, "Expected output `{expected_output}` in stdout." ++ ) ++ ++ self.assertIsNotNone(self.child.before, "Expected output before prompt") ++ self.assertIsInstance(self.child.before, bytes) ++ echoed_text: str = self.child.before.decode("ascii").strip() ++ self.assertEqual( ++ command, echoed_text, f"Command '{command}' should be echoed to stdout." ++ ) ++ ++ if match_expected: ++ child.expect_exact(self.PYTHON_PROMPT) ++ ++ def test_python_interpreter_echo(self): ++ """Test that that the user typed commands is echoed to stdout""" ++ ++ self.launch(use_colors=False, dimensions=(100, 100)) ++ ++ # Enter the python interpreter. ++ self.verify_command_echo( ++ "script --language python --", expected_output="Python.*\\.", is_regex=True ++ ) ++ self.child_in_script_interpreter = True ++ ++ self.verify_command_echo("val = 300") ++ self.verify_command_echo( ++ "print('result =', 300)", expected_output="result = 300" ++ ) +diff --git a/lldb/test/Shell/ScriptInterpreter/Python/io.test b/lldb/test/Shell/ScriptInterpreter/Python/io.test +new file mode 100644 +index 0000000000000..25e3de41724e0 +--- /dev/null ++++ b/lldb/test/Shell/ScriptInterpreter/Python/io.test +@@ -0,0 +1,12 @@ ++# RUN: rm -rf %t.stdout %t.stderr ++# RUN: cat %s | %lldb --script-language python > %t.stdout 2> %t.stderr ++# RUN: cat %t.stdout | FileCheck %s --check-prefix STDOUT ++# RUN: cat %t.stderr | FileCheck %s --check-prefix STDERR ++script ++variable = 300 ++print(variable) ++print(not_value) ++quit ++ ++# STDOUT: 300 ++# STDERR: NameError{{.*}}is not defined diff --git a/SOURCES/changelog b/SOURCES/changelog new file mode 100644 index 0000000..6a50205 --- /dev/null +++ b/SOURCES/changelog @@ -0,0 +1,1013 @@ +* Mon Jul 28 2025 Paul Murphy - 20.1.8-3 +- Backport fix for pgo optimized rust toolchain on ppc64le (rhbz#2382683) +- Backport fix for crbit spill miscompile on ppc64le power9 and power10 (rhbz#2383037) +- Backport fix for build of highway package on ppc64le (rhbz#2383182) + +* Thu Jul 24 2025 Fedora Release Engineering - 20.1.8-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + +* Wed Jul 09 2025 Nikita Popov - 20.1.8-1 +- Update to LLVM 20.1.8 + +* Fri Jun 20 2025 Kashyap Chamarthy - 20.1.7-2 +- Add riscv64 enablement bits; thanks: Songsong Zhang + (U2FsdGVkX1@gmail.com) and David Abdurachmanov (davidlt@rivosinc.com) + +* Thu Jun 19 2025 Nikita Popov - 20.1.7-1 +- Update to LLVM 20.1.7 + +* Tue Jun 17 2025 Nikita Popov - 20.1.6-10 +- Fix llvm-config alternatives handling (rhbz#2361779) + +* Mon Jun 16 2025 Nikita Popov - 20.1.6-9 +- Use libdir suffix in versioned prefix + +* Tue Jun 10 2025 Nikita Popov - 20.1.6-8 +- Invert symlink direction +- Fix i686 multilib installation (rhbz#2365079) + +* Thu Jun 05 2025 Timm Bäder - 20.1.6-7 +- Backport patch to fix rhbz#2363895 + +* Wed Jun 04 2025 Python Maint - 20.1.6-6 +- Rebuilt for Python 3.14 + +* Wed Jun 04 2025 Python Maint - 20.1.6-5 +- Bootstrap for Python 3.14 + +* Wed Jun 04 2025 Python Maint - 20.1.6-4 +- Rebuilt for Python 3.14 + +* Tue Jun 03 2025 Tulio Magno Quites Machado Filho - 20.1.6-3 +- Remove temporary changes on ppc64le + +* Tue Jun 03 2025 Python Maint - 20.1.6-2 +- Rebuilt for Python 3.14 + +* Fri May 30 2025 Nikita Popov - 20.1.6-1 +- Update to LLVM 20.1.6 + +* Mon May 26 2025 Konrad Kleine - 20.1.5-2 +- Build with PGO + +* Thu May 22 2025 Nikita Popov - 20.1.5-1 +- Update to LLVM 20.1.5 + +* Tue May 06 2025 Tom Stellard - 20.1.4-6 +- Fix build on ppc64le with glibc >= 2.42 + +* Tue May 06 2025 Nikita Popov - 20.1.4-5 +- Update to LLVM 20.1.4 + +* Sat Apr 26 2025 Tom Stellard - 20.1.3-2 +- Fix build with glibc >= 2.42 + +* Thu Apr 17 2025 Nikita Popov - 20.1.3-1 +- Update to LLVM 20.1.3 + +* Fri Apr 04 2025 Tom Stellard - 20.1.2-5 +- Drop ARM and Mips targets on RHEL + +* Thu Apr 03 2025 Timm Bäder - 20.1.2-4 +- Remove gpu-loader binaries + +* Thu Apr 03 2025 Nikita Popov - 20.1.2-3 +- Update to LLVM 20.1.2 + +* Tue Apr 01 2025 Miro Hrončok - 20.1.1-2 +- Drop redundant runtime requirement on python3-setuptools from python3-lit + +* Wed Mar 19 2025 Nikita Popov - 20.1.1-1 +- Update to LLVM 20.1.1 + +* Tue Mar 18 2025 Nikita Popov - 20.1.0-2 +- Move clang-scan-deps to clang package (rhbz#2353000) + +* Wed Mar 05 2025 Nikita Popov - 20.1.0-1 +- Update to LLVM 20.1.0 + +* Thu Feb 27 2025 Nikita Popov - 20.1.0~rc3-1 +- Update to LLVM 20 rc 3 + +* Tue Feb 25 2025 Nikita Popov - 19.1.7-11 +- Add clang-devel -> llvm-devel dep (rhbz#2342979) + +* Thu Feb 20 2025 Yaakov Selkowitz - 19.1.7-10 +- Do not rely on alternatives path + +* Fri Feb 14 2025 Nikita Popov - 19.1.7-9 +- Rename llvm-resource-filesystem -> llvm-filesystem + +* Wed Feb 12 2025 Nikita Popov - 19.1.7-8 +- Backport bolt fix (rhbz#2344830) + +* Wed Feb 12 2025 Nikita Popov - 19.1.7-7 +- Introduce llvm-resource-filesystem + +* Tue Feb 04 2025 Nikita Popov - 19.1.7-6 +- Don't use directory symlinks + +* Fri Jan 31 2025 Konrad Kleine - 19.1.7-5 +- Address installability issue with directories that were turned into symlinks + +* Thu Jan 30 2025 Josh Stone - 19.1.7-4 +- Fix an isel error triggered by Rust 1.85 on s390x + +* Wed Jan 22 2025 Konrad Kleine - 19.1.7-3 +- Add polly + +* Mon Jan 20 2025 Konrad Kleine - 19.1.7-2 +- Add bolt + +* Mon Jan 20 2025 Timm Bäder - 19.1.7-1 +- Update to 19.1.7 + +* Fri Jan 17 2025 Fedora Release Engineering - 19.1.6-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + +* Tue Dec 24 2024 Konrad Kleine - 19.1.6-3 +- Add libcxx + +* Thu Dec 19 2024 Nikita Popov - 19.1.6-2 +- Fix mlir exports + +* Wed Dec 18 2024 Timm Bäder - 19.1.6-1 +- Update to 19.1.6 + +* Fri Dec 06 2024 Konrad Kleine - 19.1.5-3 +- Fix mlir and openmp tests +- Disable libomp tests on s390x RHEL entirely. + +* Wed Dec 04 2024 Konrad Kleine - 19.1.5-2 +- Add mlir + +* Tue Dec 03 2024 Timm Bäder - 19.1.5-1 +- Update to 19.1.5 + +* Tue Nov 26 2024 Tulio Magno Quites Machado Filho - 19.1.4-2 +- Enable LLVM_ENABLE_ZSTD (rhbz#2321848) + +* Thu Nov 21 2024 Timm Bäder - 19.1.4-1 +- Update to 19.1.4 + +* Tue Nov 19 2024 Konrad Kleine - 19.1.3-4 +- Remove HTML documentation +- Add lldb man pages + +* Mon Nov 18 2024 Josh Stone - 19.1.3-3 +- Fix profiling after a binutils NOTE change (rhbz#2322754) + +* Mon Nov 18 2024 Timm Bäder - 19.1.3-2 +- Install i386 config files on x86_64 + +* Tue Nov 05 2024 Timm Bäder - 19.1.3-1 +- Update to 19.1.3 + +* Tue Sep 24 2024 Maxwell G - 19.1.0-2 +- Add 'Provides: clangd' to the clang-tools-extra subpackage + +* Thu Sep 19 2024 Timm Bäder - 19.1.0-1 +- Update to LLVM 19.1.0 + +* Thu Jul 18 2024 Fedora Release Engineering - 18.1.8-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Thu Jul 11 2024 Jesus Checa Hidalgo - 18.1.8-1 +- Update to LLVM 18.1.8 + +* Fri Jun 07 2024 Tom Stellard - 18.1.7-1 +- 18.1.7 Release + +* Tue May 28 2024 Nikita Popov - 18.1.6-2 +- Fix use after free on ppc64le (rhbz#2283525) + +* Sat May 18 2024 Tom Stellard - 18.1.6-1 +- 18.1.6 Release + +* Tue May 14 2024 Tom Stellard - 18.1.3-2 +- Backport fix for rhbz#2275090 + +* Thu Apr 25 2024 Tom Stellard - 18.1.4-1 +- 18.1.4 Release + +* Fri Apr 12 2024 Tom Stellard - 18.1.3-1 +- 18.1.3 Release + +* Thu Mar 21 2024 Zhengyu He - 18.1.2-2 +- Add support for riscv64 + +* Thu Mar 21 2024 Tom Stellard - 18.1.2-1 +- 18.1.2 Release + +* Mon Mar 11 2024 Tom Stellard - 18.1.1-1 +- 18.1.1 Release + +* Tue Feb 27 2024 Tom Stellard - 18.1.0~rc4-1 +- 18.1.0-rc4 Release + +* Tue Feb 20 2024 Tom Stellard - 18.1.0~rc3-1 +- 18.1.0-rc3 Release + +* Thu Feb 01 2024 Nikita Popov - 17.0.6-6 +- Fix crash with -fzero-call-used-regs (rhbz#2262260) + +* Mon Jan 29 2024 Nikita Popov - 17.0.6-5 +- Only use cet-report=error on x86_64 + +* Thu Jan 25 2024 Fedora Release Engineering - 17.0.6-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Sun Jan 21 2024 Fedora Release Engineering - 17.0.6-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Thu Nov 30 2023 Tulio Magno Quites Machado Filho - 17.0.6-2 +- Fix rhbz #2248872 + +* Tue Nov 28 2023 Tulio Magno Quites Machado Filho - 17.0.6-1 +- Update to LLVM 17.0.6 + +* Tue Nov 14 2023 Tulio Magno Quites Machado Filho - 17.0.5-1 +- Update to LLVM 17.0.5 + +* Tue Oct 31 2023 Tulio Magno Quites Machado Filho - 17.0.4-1 +- Update to LLVM 17.0.4 + +* Tue Oct 17 2023 Tulio Magno Quites Machado Filho - 17.0.3-1 +- Update to LLVM 17.0.3 + +* Tue Oct 03 2023 Tulio Magno Quites Machado Filho - 17.0.2-1 +- Update to LLVM 17.0.2 + +* Fri Sep 22 2023 Tulio Magno Quites Machado Filho - 17.0.1~rc4-1 +- Update to LLVM 17.0.1 + +* Tue Sep 05 2023 Tulio Magno Quites Machado Filho - 17.0.0~rc4-1 +- Update to LLVM 17.0.0 RC4 + +* Thu Aug 24 2023 Tulio Magno Quites Machado Filho - 17.0.0~rc3-1 +- Update to LLVM 17.0.0 RC3 + +* Thu Aug 24 2023 Tulio Magno Quites Machado Filho - 17.0.0~rc2-2 +- Temporarily disable a failing test on ppc64le + +* Thu Aug 17 2023 Tulio Magno Quites Machado Filho - 17.0.0~rc2-1 +- Update to LLVM 17.0.0 RC2 + +* Wed Aug 16 2023 Tulio Magno Quites Machado Filho - 17.0.0~rc1-4 +- Disable LTO on i686 + +* Mon Aug 14 2023 Tulio Magno Quites Machado Filho - 17.0.0~rc1-3 +- Re-add patch removed by mistake + +* Tue Aug 01 2023 Tulio Magno Quites Machado Filho - 17.0.0~rc1-2 +- Enable LLVM_UNREACHABLE_OPTIMIZE temporarily + +* Mon Jul 31 2023 Tulio Magno Quites Machado Filho - 17.0.0~rc1-1 +- Update to LLVM 17.0.0 RC1 + +* Mon Jul 31 2023 Tulio Magno Quites Machado Filho - 16.0.6-6 +- Fix rhbz #2224885 + +* Thu Jul 20 2023 Fedora Release Engineering - 16.0.6-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Mon Jul 10 2023 Tulio Magno Quites Machado Filho - 16.0.6-4 +- Use LLVM_UNITTEST_LINK_FLAGS to reduce link times for unit tests + +* Mon Jul 03 2023 Tulio Magno Quites Machado Filho - 16.0.6-3 +- Improve error messages for unsupported relocs on s390x (rhbz#2216906) +- Disable LLVM_UNREACHABLE_OPTIMIZE + +* Wed Jun 14 2023 Tulio Magno Quites Machado Filho - 16.0.6-1 +- Update to LLVM 16.0.6 + +* Fri Jun 09 2023 Nikita Popov - 16.0.5-2 +- Split off llvm-cmake-utils package + +* Mon Jun 05 2023 Tulio Magno Quites Machado Filho - 16.0.5-1 +- Update to LLVM 16.0.5 + +* Fri May 19 2023 Yaakov Selkowitz - 16.0.4-2 +- Avoid recommonmark dependency in RHEL builds + +* Thu May 18 2023 Tulio Magno Quites Machado Filho - 16.0.4-1 +- Update to LLVM 16.0.4 + +* Tue May 09 2023 Tulio Magno Quites Machado Filho - 16.0.3-1 +- Update to LLVM 16.0.3 + +* Tue Apr 25 2023 Tulio Magno Quites Machado Filho - 16.0.2-1 +- Update to LLVM 16.0.2 + +* Tue Apr 11 2023 Tulio Magno Quites Machado Filho - 16.0.1-1 +- Update to LLVM 16.0.1 + +* Thu Mar 23 2023 Tulio Magno Quites Machado Filho - 16.0.0-2 +- Distribute libllvm_gtest.a and libllvm_gtest_main.a with llvm-googletest +- Stop distributing /usr/share/llvm/src/utils + +* Mon Mar 20 2023 Tulio Magno Quites Machado Filho - 16.0.0-1 +- Update to LLVM 16.0.0 + +* Thu Mar 16 2023 Tulio Magno Quites Machado Filho - 16.0.0~rc4-2 +- Fix the ppc64le triple + +* Tue Mar 14 2023 Tulio Magno Quites Machado Filho - 16.0.0~rc4-1 +- Update to LLVM 16.0.0 RC4 + +* Fri Mar 10 2023 Tulio Magno Quites Machado Filho - 16.0.0~rc3-2 +- Fix llvm-exegesis failures on s390x + +* Wed Feb 22 2023 Tulio Magno Quites Machado Filho - 16.0.0~rc3-1 +- Update to LLVM 16.0.0 RC3 + +* Wed Feb 01 2023 Tulio Magno Quites Machado Filho - 16.0.0~rc1-1 +- Update to LLVM 16.0.0 RC1 + +* Thu Jan 19 2023 Tulio Magno Quites Machado Filho - 15.0.7-3 +- Update license to SPDX identifiers. +- Include the Apache license adopted in 2019. + +* Thu Jan 19 2023 Fedora Release Engineering - 15.0.7-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Thu Jan 12 2023 Nikita Popov - 15.0.7-1 +- Update to LLVM 15.0.7 + +* Mon Jan 09 2023 Tom Stellard - 15.0.6-3 +- Omit frame pointers when building + +* Mon Dec 19 2022 Nikita Popov - 15.0.6-2 +- Remove workaround for rbhz#2048440 + +* Mon Dec 05 2022 Nikita Popov - 15.0.6-1 +- Update to LLVM 15.0.6 + +* Fri Nov 11 2022 Nikita Popov - 15.0.4-2 +- Copy CFLAGS to ASMFLAGs to enable CET in asm files + +* Wed Nov 02 2022 Nikita Popov - 15.0.4-1 +- Update to LLVM 15.0.4 + +* Tue Sep 27 2022 Nikita Popov - 15.0.0-2 +- Export GetHostTriple.cmake + +* Tue Sep 06 2022 Nikita Popov - 15.0.0-1 +- Update to LLVM 15.0.0 + +* Thu Jul 21 2022 Fedora Release Engineering - 14.0.5-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Fri Jun 17 2022 Timm Bäder - 14.0.5-2 +- Release bump for new redhat-rpm-config + +* Mon Jun 13 2022 Timm Bäder - 14.0.5-1 +- 14.0.5 Release + +* Wed May 18 2022 Tom Stellard - 14.0.3-1 +- 14.0.3 Release + +* Fri Apr 29 2022 Timm Bäder - 14.0.0-2 +- Remove llvm-cmake-devel package + +* Wed Mar 23 2022 Timm Bäder - 14.0.0-1 +- Update to LLVM 14.0.0 + +* Wed Feb 02 2022 Nikita Popov - 13.0.1-1 +- Update to LLVM 13.0.1 final + +* Tue Jan 25 2022 Nikita Popov - 13.0.1~rc3-1 +- Update to LLVM 13.0.1rc3 + +* Thu Jan 20 2022 Fedora Release Engineering - 13.0.1~rc2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Thu Jan 13 2022 Nikita Popov - 13.0.1~rc2-1 +- Update to LLVM 13.0.1rc2 + +* Mon Jan 10 2022 Nikita Popov - 13.0.1~rc1-1 +- Upstream 13.0.1 rc1 release + +* Sat Jan 08 2022 Miro Hrončok - 13.0.0-8 +- Rebuilt for https://fedoraproject.org/wiki/Changes/LIBFFI34 + +* Thu Nov 11 2021 Tom Stellard - 13.0.0-7 +- Enable lto on s390x and arm + +* Mon Oct 25 2021 Tom Stellard - 13.0.0-6 +- Build with Thin LTO + +* Mon Oct 18 2021 Tom Stellard - 13.0.0-5 +- Build with clang + +* Fri Oct 08 2021 Tom Stellard - 13.0.0-4 +- Fix default triple on arm + +* Wed Oct 06 2021 Tom Stellard - 13.0.0-3 +- Set default triple + +* Mon Oct 04 2021 Tom Stellard - 13.0.0-2 +- Drop abi_revision from soname + +* Thu Sep 30 2021 Tom Stellard - 13.0.0-1 +- 13.0.0 Release + +* Thu Sep 30 2021 Tom Stellard - 13.0.0~rc4-2 +- Restore config.guess for host triple detection + +* Fri Sep 24 2021 Tom Stellard - 13.0.0~rc4-1 +- 13.0.0-rc4 Release + +* Fri Sep 17 2021 Tom Stellard - 13.0.0~rc3-1 +- 13.0.0-rc3 Release + +* Mon Sep 13 2021 Tom Stellard - 13.0.0~rc1-3 +- Pass LLVM_DEFAULT_TARGET_TRIPLE to cmake + +* Mon Sep 13 2021 Konrad Kleine - 13.0.0~rc1-2 +- Add --without=check option + +* Wed Aug 04 2021 Tom Stellard - 13.0.0~rc1-1 +- 13.0.0-rc1 Release + +* Thu Jul 22 2021 sguelton@redhat.com - 12.0.1-3 +- Maintain versionned link to llvm-config + +* Thu Jul 22 2021 Fedora Release Engineering - 12.0.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Mon Jul 12 2021 Tom Stellard - 12.0.1-1 +- 12.0.1 Release + +* Wed Jun 30 2021 Tom Stellard - llvm-12.0.1~rc3-1 +- 12.0.1-rc3 Release + +* Fri May 28 2021 Tom Stellard - 12.0.1~rc1-2 +- Stop installing lit tests + +* Wed May 26 2021 Tom Stellard - llvm-12.0.1~rc1-1 +- 12.0.1-rc1 Release + +* Mon May 17 2021 sguelton@redhat.com - 12.0.0-7 +- Fix handling of llvm-config + +* Mon May 03 2021 kkleine@redhat.com - 12.0.0-6 +- More verbose builds thanks to python3-psutil + +* Sat May 01 2021 sguelton@redhat.com - 12.0.0-5 +- Fix llvm-config install + +* Tue Apr 27 2021 sguelton@redhat.com - 12.0.0-4 +- Provide default empty value for exec_suffix when not in compat mode + +* Tue Apr 27 2021 sguelton@redhat.com - 12.0.0-3 +- Fix llvm-config install + +* Tue Apr 20 2021 sguelton@redhat.com - 12.0.0-2 +- Backport compat package fix + +* Thu Apr 15 2021 Tom Stellard - 12.0.0-1 +- 12.0.0 Release + +* Thu Apr 08 2021 sguelton@redhat.com - 12.0.0-0.11.rc5 +- New upstream release candidate + +* Tue Apr 06 2021 sguelton@redhat.com - 12.0.0-0.10.rc4 +- Patch test case for compatibility with llvm-test latout + +* Fri Apr 02 2021 sguelton@redhat.com - 12.0.0-0.9.rc4 +- New upstream release candidate + +* Wed Mar 31 2021 Jonathan Wakely - 12.0.0-0.8.rc3 +- Rebuilt for removed libstdc++ symbols (#1937698) + +* Thu Mar 11 2021 sguelton@redhat.com - 12.0.0-0.7.rc3 +- LLVM 12.0.0 rc3 + +* Wed Mar 10 2021 Kalev Lember - 12.0.0-0.6.rc2 +- Add llvm-static(major) provides to the -static subpackage + +* Tue Mar 09 2021 sguelton@redhat.com - 12.0.0-0.5.rc2 +- rebuilt + +* Tue Mar 02 2021 sguelton@redhat.com - 12.0.0-0.4.rc2 +- Change CI working dir + +* Wed Feb 24 2021 sguelton@redhat.com - 12.0.0-0.3.rc2 +- 12.0.0-rc2 release + +* Tue Feb 16 2021 Dave Airlie - 12.0.0-0.2.rc1 +- Enable LLVM_USE_PERF to allow perf integration + +* Tue Feb 2 2021 Serge Guelton - 12.0.0-0.1.rc1 +- 12.0.0-rc1 release + +* Tue Jan 26 2021 Fedora Release Engineering - 11.1.0-0.3.rc2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Fri Jan 22 2021 Serge Guelton - 11.1.0-0.2.rc2 +- 11.1.0-rc2 release + +* Thu Jan 14 2021 Serge Guelton - 11.1.0-0.1.rc1 +- 11.1.0-rc1 release + +* Tue Jan 05 2021 Serge Guelton - 11.0.1-3.rc2 +- Waive extra test case + +* Sun Dec 20 2020 sguelton@redhat.com - 11.0.1-2.rc2 +- 11.0.1-rc2 release + +* Tue Dec 01 2020 sguelton@redhat.com - 11.0.1-1.rc1 +- 11.0.1-rc1 release + +* Sat Oct 31 2020 Jeff Law - 11.0.0-2 +- Fix missing #include for gcc-11 + +* Wed Oct 14 2020 Josh Stone - 11.0.0-1 +- Fix coreos-installer test crash on s390x (rhbz#1883457) + +* Mon Oct 12 2020 sguelton@redhat.com - 11.0.0-0.11 +- llvm 11.0.0 - final release + +* Thu Oct 08 2020 sguelton@redhat.com - 11.0.0-0.10.rc6 +- 11.0.0-rc6 + +* Fri Oct 02 2020 sguelton@redhat.com - 11.0.0-0.9.rc5 +- 11.0.0-rc5 Release + +* Sun Sep 27 2020 sguelton@redhat.com - 11.0.0-0.8.rc3 +- Fix NVR + +* Thu Sep 24 2020 sguelton@redhat.com - 11.0.0-0.2.rc3 +- Obsolete patch for rhbz#1862012 + +* Thu Sep 24 2020 sguelton@redhat.com - 11.0.0-0.1.rc3 +- 11.0.0-rc3 Release + +* Wed Sep 02 2020 sguelton@redhat.com - 11.0.0-0.7.rc2 +- Apply upstream patch for rhbz#1862012 + +* Tue Sep 01 2020 sguelton@redhat.com - 11.0.0-0.6.rc2 +- Fix source location + +* Fri Aug 21 2020 Tom Stellard - 11.0.0-0.5.rc2 +- 11.0.0-rc2 Release + +* Wed Aug 19 2020 Tom Stellard - 11.0.0-0.4.rc1 +- Fix regression-tests CI tests + +* Tue Aug 18 2020 Tom Stellard - 11.0.0-0.3.rc1 +- Fix rust crash on ppc64le compiling firefox +- rhbz#1862012 + +* Tue Aug 11 2020 Tom Stellard - 11.0.0-0.2.rc1 +- Install update_cc_test_checks.py script + +* Thu Aug 06 2020 Tom Stellard - 11.0.0-0.1-rc1 +- LLVM 11.0.0-rc1 Release +- Make llvm-devel require llvm-static and llvm-test + +* Tue Aug 04 2020 Tom Stellard - 10.0.0-10 +- Backport upstream patch to fix build with -flto. +- Disable LTO on s390x to work-around unit test failures. + +* Sat Aug 01 2020 sguelton@redhat.com - 10.0.0-9 +- Fix update-alternative uninstall script + +* Sat Aug 01 2020 sguelton@redhat.com - 10.0.0-8 +- Fix gpg verification and update macro usage. + +* Sat Aug 01 2020 Fedora Release Engineering - 10.0.0-7 +- Second attempt - Rebuilt for + https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Tue Jul 28 2020 Fedora Release Engineering - 10.0.0-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild +* Thu Jun 11 2020 sguelton@redhat.com - 10.0.0-5 +- Make llvm-test.tar.gz creation reproducible. + +* Tue Jun 02 2020 sguelton@redhat.com - 10.0.0-4 +- Instruct cmake not to generate RPATH + +* Thu Apr 30 2020 Tom Stellard - 10.0.0-3 +- Install LLVMgold.so symlink in bfd-plugins directory + +* Tue Apr 07 2020 sguelton@redhat.com - 10.0.0-2 +- Do not package UpdateTestChecks tests in llvm-tests +- Apply upstream patch bab5908df to pass gating tests + +* Wed Mar 25 2020 sguelton@redhat.com - 10.0.0-1 +- 10.0.0 final + +* Mon Mar 23 2020 sguelton@redhat.com - 10.0.0-0.6.rc6 +- 10.0.0 rc6 + +* Thu Mar 19 2020 sguelton@redhat.com - 10.0.0-0.5.rc5 +- 10.0.0 rc5 + +* Sat Mar 14 2020 sguelton@redhat.com - 10.0.0-0.4.rc4 +- 10.0.0 rc4 + +* Thu Mar 05 2020 sguelton@redhat.com - 10.0.0-0.3.rc3 +- 10.0.0 rc3 + +* Fri Feb 28 2020 sguelton@redhat.com - 10.0.0-0.2.rc2 +- Remove *_finite support, see rhbz#1803203 + +* Fri Feb 14 2020 sguelton@redhat.com - 10.0.0-0.1.rc2 +- 10.0.0 rc2 + +* Fri Jan 31 2020 sguelton@redhat.com - 10.0.0-0.1.rc1 +- 10.0.0 rc1 + +* Wed Jan 29 2020 Fedora Release Engineering - 9.0.1-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Tue Jan 21 2020 Tom Stellard - 9.0.1-4 +- Rebuild after previous build failed to strip binaries + +* Fri Jan 17 2020 Tom Stellard - 9.0.1-3 +- Add explicit Requires from sub-packages to llvm-libs + +* Fri Jan 10 2020 Tom Stellard - 9.0.1-2 +- Fix crash with kernel bpf self-tests + +* Thu Dec 19 2019 tstellar@redhat.com - 9.0.1-1 +- 9.0.1 Release + +* Mon Nov 25 2019 sguelton@redhat.com - 9.0.0-4 +- Activate AVR on all architectures + +* Mon Sep 30 2019 Tom Stellard - 9.0.0-3 +- Build libLLVM.so first to avoid OOM errors + +* Fri Sep 27 2019 Tom Stellard - 9.0.0-2 +- Remove unneeded BuildRequires: libstdc++-static + +* Thu Sep 19 2019 sguelton@redhat.com - 9.0.0-1 +- 9.0.0 Release + +* Wed Sep 18 2019 sguelton@redhat.com - 9.0.0-0.5.rc3 +- Support avr target, see rhbz#1718492 + +* Tue Sep 10 2019 Tom Stellard - 9.0.0-0.4.rc3 +- Split out test executables into their own export file + +* Fri Sep 06 2019 Tom Stellard - 9.0.0-0.3.rc3 +- Fix patch for splitting out static library exports + +* Fri Aug 30 2019 Tom Stellard - 9.0.0-0.2.rc3 +- 9.0.0-rc3 Release + +* Thu Aug 01 2019 Tom Stellard - 9.0.0-0.1.rc2 +- 9.0.0-rc2 Release + +* Tue Jul 30 2019 Tom Stellard - 8.0.0-9 +- Sync with llvm8.0 spec file + +* Thu Jul 25 2019 Fedora Release Engineering - 8.0.0-8.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Wed Jul 17 2019 Tom Stellard - 8.0.0-8 +- Add provides for the major version of sub-packages + +* Fri May 17 2019 sguelton@redhat.com - 8.0.0-7 +- Fix conflicts between llvm-static = 8 and llvm-dev < 8 around LLVMStaticExports.cmake + +* Wed Apr 24 2019 Tom Stellard - 8.0.0-6 +- Make sure we aren't passing -g on s390x + +* Sat Mar 30 2019 Tom Stellard - 8.0.0-5 +- Enable build rpath while keeping install rpath disabled + +* Wed Mar 27 2019 Tom Stellard - 8.0.0-4 +- Backport r351577 from trunk to fix ninja check failures + +* Tue Mar 26 2019 Tom Stellard - 8.0.0-3 +- Fix ninja check + +* Fri Mar 22 2019 Tom Stellard - 8.0.0-2 +- llvm-test fixes + +* Wed Mar 20 2019 sguelton@redhat.com - 8.0.0-1 +- 8.0.0 final + +* Fri Mar 15 2019 sguelton@redhat.com - 8.0.0-0.6.rc4 +- Activate all backends (rhbz#1689031) + +* Tue Mar 12 2019 sguelton@redhat.com - 8.0.0-0.5.rc4 +- 8.0.0 Release candidate 4 + +* Mon Mar 4 2019 sguelton@redhat.com - 8.0.0-0.4.rc3 +- Move some binaries to -test package, cleanup specfile + +* Mon Mar 4 2019 sguelton@redhat.com - 8.0.0-0.3.rc3 +- 8.0.0 Release candidate 3 + +* Fri Feb 22 2019 sguelton@redhat.com - 8.0.0-0.2.rc2 +- 8.0.0 Release candidate 2 + +* Sat Feb 9 2019 sguelton@redhat.com - 8.0.0-0.1.rc1 +- 8.0.0 Release candidate 1 + +* Fri Feb 01 2019 Fedora Release Engineering - 7.0.1-2.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Mon Jan 21 2019 Josh Stone - 7.0.1-2 +- Fix discriminators in metadata, rhbz#1668033 + +* Mon Dec 17 2018 sguelton@redhat.com - 7.0.1-1 +- 7.0.1 release + +* Tue Dec 04 2018 sguelton@redhat.com - 7.0.0-5 +- Ensure rpmlint passes on specfile + +* Sat Nov 17 2018 Tom Stellard - 7.0.0-4 +- Install testing libraries for unittests + +* Sat Oct 27 2018 Tom Stellard - 7.0.0-3 +- Fix running unittests as not-root user + +* Thu Sep 27 2018 Tom Stellard - 7.0.0-2 +- Fixes for llvm-test package: +- Add some missing Requires +- Add --threads option to run-lit-tests script +- Set PATH so lit can find tools like count, not, etc. +- Don't hardcode tools directory to /usr/lib64/llvm +- Fix typo in yaml-bench define +- Only print information about failing tests + +* Fri Sep 21 2018 Tom Stellard - 7.0.0-1 +- 7.0.0 Release + +* Thu Sep 13 2018 Tom Stellard - 7.0.0-0.15.rc3 +- Disable rpath on install LLVM and related sub-projects + +* Wed Sep 12 2018 Tom Stellard - 7.0.0-0.14.rc3 +- Remove rpath from executables and libraries + +* Tue Sep 11 2018 Tom Stellard - 7.0.0-0.13.rc3 +- Re-enable arm and aarch64 targets on x86_64 + +* Mon Sep 10 2018 Tom Stellard - 7.0.0-0.12.rc3 +- 7.0.0-rc3 Release + +* Fri Sep 07 2018 Tom Stellard - 7.0.0-0.11.rc2 +- Use python3 shebang for opt-viewewr scripts + +* Thu Aug 30 2018 Tom Stellard - 7.0.0-0.10.rc2 +- Drop all uses of python2 from lit tests + +* Thu Aug 30 2018 Tom Stellard - 7.0.0-0.9.rc2 +- Build the gold plugin on all supported architectures + +* Wed Aug 29 2018 Kevin Fenzi - 7.0.0-0.8.rc2 +- Re-enable debuginfo to avoid 25x size increase. + +* Tue Aug 28 2018 Tom Stellard - 7.0.0-0.7.rc2 +- 7.0.0-rc2 Release + +* Tue Aug 28 2018 Tom Stellard - 7.0.0-0.6.rc1 +- Guard valgrind usage with valgrind_arches macro + +* Thu Aug 23 2018 Tom Stellard - 7.0.0-0.5.rc1 +- Package lit tests and googletest sources. + +* Mon Aug 20 2018 Tom Stellard - 7.0.0-0.4.rc1 +- Re-enable AMDGPU target on ARM rhbz#1618922 + +* Mon Aug 13 2018 Tom Stellard - 7.0.0-0.3.rc1 +- Drop references to TestPlugin.so from cmake files + +* Fri Aug 10 2018 Tom Stellard - 7.0.0-0.2.rc1 +- Fixes for lit tests + +* Fri Aug 10 2018 Tom Stellard - 7.0.0-0.1.rc1 +- 7.0.0-rc1 Release +- Reduce number of enabled targets on all arches. +- Drop s390 detection patch, LLVM does not support s390 codegen. + +* Mon Aug 06 2018 Tom Stellard - 6.0.1-6 +- Backport some fixes needed by mesa and rust + +* Thu Jul 26 2018 Tom Stellard - 6.0.1-5 +- Move libLLVM-6.0.so to llvm6.0-libs. + +* Mon Jul 23 2018 Tom Stellard - 6.0.1-4 +- Rebuild because debuginfo stripping failed with the previous build + +* Fri Jul 13 2018 Tom Stellard - 6.0.1-3 +- Sync specfile with llvm6.0 package + +* Fri Jul 13 2018 Fedora Release Engineering - 6.0.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Mon Jun 25 2018 Tom Stellard - 6.0.1-1 +- 6.0.1 Release + +* Thu Jun 07 2018 Tom Stellard - 6.0.1-0.4.rc2 +- 6.0.1-rc2 + +* Wed Jun 06 2018 Tom Stellard - 6.0.1-0.3.rc1 +- Re-enable all targets to avoid breaking the ABI. + +* Mon Jun 04 2018 Tom Stellard - 6.0.1-0.2.rc1 +- Reduce the number of enabled targets based on the architecture + +* Thu May 10 2018 Tom Stellard - 6.0.1-0.1.rc1 +- 6.0.1 rc1 + +* Tue Mar 27 2018 Tom Stellard - 6.0.0-11 +- Re-enable arm tests that used to hang + +* Thu Mar 22 2018 Tom Stellard - 6.0.0-10 +- Fix testcase in backported patch + +* Tue Mar 20 2018 Tom Stellard - 6.0.0-9 +- Prevent external projects from linking against both static and shared + libraries. rhbz#1558657 + +* Mon Mar 19 2018 Tom Stellard - 6.0.0-8 +- Backport r327651 from trunk rhbz#1554349 + +* Fri Mar 16 2018 Tom Stellard - 6.0.0-7 +- Filter out cxxflags and cflags from llvm-config that aren't supported by clang +- rhbz#1556980 + +* Wed Mar 14 2018 Tom Stellard - 6.0.0-6 +- Enable symbol versioning in libLLVM.so + +* Wed Mar 14 2018 Tom Stellard - 6.0.0-5 +- Stop statically linking libstdc++. This is no longer required by Steam + client, but the steam installer still needs a work-around which should + be handled in the steam package. +* Wed Mar 14 2018 Tom Stellard - 6.0.0-4 +- s/make check/ninja check/ + +* Fri Mar 09 2018 Tom Stellard - 6.0.0-3 +- Backport fix for compile time regression on rust rhbz#1552915 + +* Thu Mar 08 2018 Tom Stellard - 6.0.0-2 +- Build with Ninja: This reduces RPM build time on a 6-core x86_64 builder + from 82 min to 52 min. + +* Thu Mar 08 2018 Tom Stellard - 6.0.0-1 +- 6.0.0 Release + +* Thu Mar 08 2018 Tom Stellard - 6.0.0-0.5.rc2 +- Reduce debuginfo size on i686 to avoid OOM errors during linking + +* Fri Feb 09 2018 Tom Stellard - 6.0.0-0.4.rc2 +- 6.0.1 rc2 + +* Fri Feb 09 2018 Igor Gnatenko - 6.0.0-0.3.rc1 +- Escape macros in %%changelog + +* Thu Feb 08 2018 Fedora Release Engineering - 6.0.0-0.2.rc1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Fri Jan 19 2018 Tom Stellard - 6.0.0-0.1.rc1 +- 6.0.1 rc1 + +* Tue Dec 19 2017 Tom Stellard - 5.0.1-1 +- 5.0.1 Release + +* Mon Nov 20 2017 Tom Stellard - 5.0.0-5 +- Backport debuginfo fix for rust + +* Fri Nov 03 2017 Tom Stellard - 5.0.0-4 +- Reduce debuginfo size for ARM + +* Tue Oct 10 2017 Tom Stellard - 5.0.0-2 +- Reduce memory usage on ARM by disabling debuginfo and some non-ARM targets. + +* Mon Sep 25 2017 Tom Stellard - 5.0.0-1 +- 5.0.0 Release + +* Mon Sep 18 2017 Tom Stellard - 4.0.1-6 +- Add Requires: libedit-devel for llvm-devel + +* Fri Sep 08 2017 Tom Stellard - 4.0.1-5 +- Enable libedit backend for LineEditor API + +* Fri Aug 25 2017 Tom Stellard - 4.0.1-4 +- Enable extra functionality when run the LLVM JIT under valgrind. + +* Thu Aug 03 2017 Fedora Release Engineering - 4.0.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 4.0.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Wed Jun 21 2017 Tom Stellard - 4.0.1-1 +- 4.0.1 Release + +* Thu Jun 15 2017 Tom Stellard - 4.0.0-6 +- Install llvm utils + +* Thu Jun 08 2017 Tom Stellard - 4.0.0-5 +- Fix docs-llvm-man target + +* Mon May 01 2017 Tom Stellard - 4.0.0-4 +- Make cmake files no longer depend on static libs (rhbz 1388200) + +* Tue Apr 18 2017 Josh Stone - 4.0.0-3 +- Fix computeKnownBits for ARMISD::CMOV (rust-lang/llvm#67) + +* Mon Apr 03 2017 Tom Stellard - 4.0.0-2 +- Simplify spec with rpm macros. + +* Thu Mar 23 2017 Tom Stellard - 4.0.0-1 +- LLVM 4.0.0 Final Release + +* Wed Mar 22 2017 tstellar@redhat.com - 3.9.1-6 +- Fix %%postun sep for -devel package. + +* Mon Mar 13 2017 Tom Stellard - 3.9.1-5 +- Disable failing tests on ARM. + +* Sun Mar 12 2017 Peter Robinson 3.9.1-4 +- Fix missing mask on relocation for aarch64 (rhbz 1429050) + +* Wed Mar 01 2017 Dave Airlie - 3.9.1-3 +- revert upstream radeonsi breaking change. + +* Thu Feb 23 2017 Josh Stone - 3.9.1-2 +- disable sphinx warnings-as-errors + +* Fri Feb 10 2017 Orion Poplawski - 3.9.1-1 +- llvm 3.9.1 + +* Fri Feb 10 2017 Fedora Release Engineering - 3.9.0-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Tue Nov 29 2016 Josh Stone - 3.9.0-7 +- Apply backports from rust-lang/llvm#55, #57 + +* Tue Nov 01 2016 Dave Airlie - 3.9.0-5 +- apply the patch from -4 + +* Wed Oct 26 2016 Dave Airlie - 3.9.0-4 +- add fix for lldb out-of-tree build + +* Mon Oct 17 2016 Josh Stone - 3.9.0-3 +- Apply backports from rust-lang/llvm#47, #48, #53, #54 + +* Sat Oct 15 2016 Josh Stone - 3.9.0-2 +- Apply an InstCombine backport via rust-lang/llvm#51 + +* Wed Sep 07 2016 Dave Airlie - 3.9.0-1 +- llvm 3.9.0 +- upstream moved where cmake files are packaged. +- upstream dropped CppBackend + +* Wed Jul 13 2016 Adam Jackson - 3.8.1-1 +- llvm 3.8.1 +- Add mips target +- Fix some shared library mispackaging + +* Tue Jun 07 2016 Jan Vcelak - 3.8.0-2 +- fix color support detection on terminal + +* Thu Mar 10 2016 Dave Airlie 3.8.0-1 +- llvm 3.8.0 release + +* Wed Mar 09 2016 Dan Horák 3.8.0-0.3 +- install back memory consumption workaround for s390 + +* Thu Mar 03 2016 Dave Airlie 3.8.0-0.2 +- llvm 3.8.0 rc3 release + +* Fri Feb 19 2016 Dave Airlie 3.8.0-0.1 +- llvm 3.8.0 rc2 release + +* Tue Feb 16 2016 Dan Horák 3.7.1-7 +- recognize s390 as SystemZ when configuring build + +* Sat Feb 13 2016 Dave Airlie 3.7.1-6 +- export C++ API for mesa. + +* Sat Feb 13 2016 Dave Airlie 3.7.1-5 +- reintroduce llvm-static, clang needs it currently. + +* Fri Feb 12 2016 Dave Airlie 3.7.1-4 +- jump back to single llvm library, the split libs aren't working very well. + +* Fri Feb 05 2016 Dave Airlie 3.7.1-3 +- add missing obsoletes (#1303497) + +* Thu Feb 04 2016 Fedora Release Engineering - 3.7.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Thu Jan 07 2016 Jan Vcelak 3.7.1-1 +- new upstream release +- enable gold linker + +* Wed Nov 04 2015 Jan Vcelak 3.7.0-100 +- fix Requires for subpackages on the main package + +* Tue Oct 06 2015 Jan Vcelak 3.7.0-100 +- initial version using cmake build system diff --git a/SOURCES/release-keys.asc b/SOURCES/release-keys.asc index 0d3789a..3932562 100644 --- a/SOURCES/release-keys.asc +++ b/SOURCES/release-keys.asc @@ -102,3 +102,29 @@ yWfeofTJ7PhKzoXM2Y/rRFoM5gNh1RVA19ngLT5Jwiof8fPZvHJ/9ZkHn+O7eMNm m5++gYza3pnn2/PoGpGGAKok+sfJiq5Tb7RUefyJTeZiyTZ/XJrA =tMzl -----END PGP PUBLIC KEY BLOCK----- +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mDMEaMgtRhYJKwYBBAHaRw8BAQdA4NRjJPhVd56sOM+QmTbZKkRT3bYbgg6+Bxed +CELeGp+0JUN1bGxlbiBSaG9kZXMgPGN1bGxlbi5yaG9kZXNAYXJtLmNvbT6IkwQT +FgoAOxYhBHEEbR6cZla91hFxhz6Dur9KT56FBQJoyC1GAhsDBQsJCAcCAiICBhUK +CQgLAgQWAgMBAh4HAheAAAoJED6Dur9KT56FkVwA/RLNMBHrjXoAKpRm1iIjiC6w +gLRqGOnj1qAqPqgntMmmAQCQ2lGpw46rvh88ng84IGsRF0JlTAYb6SR/YYNsQyah +Arg4BGjILUYSCisGAQQBl1UBBQEBB0B48hCLw13kduwibGDGoIax0BIa+f66IUC+ +HhNlucsjbgMBCAeIeAQYFgoAIBYhBHEEbR6cZla91hFxhz6Dur9KT56FBQJoyC1G +AhsMAAoJED6Dur9KT56FVssBAO1lL/S2cU65XFHgbjc6crwljDrD7PYbxBA7hDpi +pC4ZAP98rK1hGQ5wxpeiJ0heZ8zhpdUwEeymIDBaIcwgrJRFBQ== +=HcEB +-----END PGP PUBLIC KEY BLOCK----- +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mDMEaMg2hBYJKwYBBAHaRw8BAQdA2J814YnhPQSdsyjwx8VxZ7AitqCnns9lzvkx +HX9lWMW0JERvdWdsYXMgWXVuZyA8ZG91Z2xhcy55dW5nQHNvbnkuY29tPoiTBBMW +CgA7FiEE/7M2iYDz5rtXNxRaMWxW0GTKy6UFAmjINoQCGwMFCwkIBwICIgIGFQoJ +CAsCBBYCAwECHgcCF4AACgkQMWxW0GTKy6XjYgEApJ7p+o7EAeaaOdO2f440KDfg +t7haaBLaxr5fiaSKjkYA+gLDxWOh39Y84upf23qMmpSTZ3SK5LvJtBTVtV7AEX0B +uDgEaMg2hBIKKwYBBAGXVQEFAQEHQL3CL6jHZAakhtLLj2Ks34u7ItY/7USl/bYk +f/+mZTJMAwEIB4h4BBgWCgAgFiEE/7M2iYDz5rtXNxRaMWxW0GTKy6UFAmjINoQC +GwwACgkQMWxW0GTKy6VTOgEArDn9bg58W7bfZfVfneJJbIeICEf3NN9IovbRbAOB +ax0A/RxtrG4qowLlo907vb25ITOa1hBoheSV2wNoDaDUhFEF +=JQ8u +-----END PGP PUBLIC KEY BLOCK----- diff --git a/SPECS/llvm.spec b/SPECS/llvm.spec index f90b7e6..1d4e491 100644 --- a/SPECS/llvm.spec +++ b/SPECS/llvm.spec @@ -1,9 +1,9 @@ #region globals #region version -%global maj_ver 19 +%global maj_ver 21 %global min_ver 1 -%global patch_ver 7 -#global rc_ver 4 +%global patch_ver 8 +#global rc_ver rc3 %bcond_with snapshot_build %if %{with snapshot_build} @@ -19,6 +19,23 @@ %bcond_with gold %endif +# Enable this in order to disable a lot of features and get to clang as fast +# as possible. This is useful in order to bisect issues affecting LLVM, clang +# or LLD. +%bcond_with fastclang +%if %{with fastclang} +%define bcond_override_default_lldb 0 +%define bcond_override_default_offload 0 +%define bcond_override_default_mlir 0 +%define bcond_override_default_flang 0 +%define bcond_override_default_build_bolt 0 +%define bcond_override_default_polly 0 +%define bcond_override_default_pgo 0 +%define bcond_override_default_libcxx 0 +%define bcond_override_default_lto_build 0 +%define bcond_override_default_check 0 +%endif + # Build compat packages llvmN instead of main package for the current LLVM # version. Used on Fedora. %bcond_with compat_build @@ -28,37 +45,208 @@ %bcond_without check %if %{with bundle_compat_lib} -%global compat_maj_ver 18 +%global compat_maj_ver 20 %global compat_ver %{compat_maj_ver}.1.8 %endif -# Compat builds do not include python-lit and lldb +# Compat builds do not include python-lit %if %{with compat_build} %bcond_with python_lit -%bcond_with lldb %else %bcond_without python_lit -%bcond_without lldb %endif +%bcond_without lldb + +%ifarch ppc64le +%if %{defined rhel} && 0%{?rhel} < 10 +# RHEL <= 9 use the IBM long double format, which is not supported by libc. +# Since LLVM 21, parts of libc are required in order to build offload. +%bcond_with offload +%else +%bcond_without offload +%endif +%else +%ifarch %{ix86} +# libomptarget is not supported on 32-bit systems. +%bcond_with offload +%else +%bcond_without offload +%endif +%endif + +# MLIR version 22 started to require nanobind >= 2.9, which is only available +# on Fedora >= 44. +%if %{without compat_build} && %{defined fedora} && (%{maj_ver} < 22 || 0%{?fedora} >= 44) +%ifarch %{ix86} +%bcond_with mlir +%else +%bcond_without mlir +%endif +%else +%bcond_with mlir +%endif + +#region flang +%if %{without compat_build} && %{defined fedora} && (%{maj_ver} >= 22 && 0%{?fedora} >= 44) +# Link error on i686. +# s390x is not supported upstream yet. +%ifarch i686 s390x +%bcond_with flang +%else +%bcond_without flang +%endif +%endif + +%if %{with flang} + +# Sanity check for flang +# flang depends on mlir, clang, flang, openmp. +# Make sure those are being built. +%if %{without mlir} +%{error:flang must be built --with=mlir} +%endif + +# Set Fortran build flags to nil because they contain flags that don't apply to flang. +%global build_fflags %{nil} + +%{lua: + +-- Return the maximum number of parallel jobs a build can run based on the +-- amount of maximum memory used per process (per_proc_mem). +function print_max_procs(per_proc_mem) + local f = io.open("/proc/meminfo", "r") + local mem = 0 + local nproc_str = nil + for line in f:lines() do + _, _, mem = string.find(line, "MemTotal:%s+(%d+)%s+kB") + if mem then + break + end + end + f:close() + + local proc_handle = io.popen("nproc") + _, _, nproc_str = string.find(proc_handle:read("*a"), "(%d+)") + proc_handle:close() + local nproc = tonumber(nproc_str) + if nproc < 1 then + nproc = 1 + end + local mem_mb = mem / 1024 + local cpu = math.floor(mem_mb / per_proc_mem) + if cpu < 1 then + cpu = 1 + end + + if cpu > nproc then + cpu = nproc + end + print(cpu) +end +} +%endif +#endregion flang + +# The libcxx build condition also enables libcxxabi and libunwind. +%if %{without compat_build} && %{defined fedora} +%bcond_without libcxx +%else +%bcond_with libcxx +%endif + +# I've called the build condition "build_bolt" to indicate that this does not +# necessarily "use" BOLT in order to build LLVM. +%if %{without compat_build} && %{defined fedora} +# BOLT only supports aarch64 and x86_64 +%ifarch aarch64 x86_64 +%bcond_without build_bolt +%else +%bcond_with build_bolt +%endif +%else +%bcond_with build_bolt +%endif + +%if %{without compat_build} && %{defined fedora} +%bcond_without polly +%else +%bcond_with polly +%endif + +#region pgo +%ifarch %{ix86} +%bcond_with pgo +%else +%if 0%{?fedora} >= 43 || 0%{?rhel} >= 9 +%bcond_without pgo +%else +%bcond_with pgo +%endif +%endif + +# Sanity checks for PGO and bootstrapping +#---------------------------------------- +%if %{with pgo} +%ifarch %{ix86} +%{error:Your architecture is not allowed for PGO because it is in this list: %{ix86}} +%endif +%endif +#---------------------------------------- +#endregion pgo + # Disable LTO on x86 and riscv in order to reduce memory consumption. %ifarch %ix86 riscv64 %bcond_with lto_build %else +%if %{defined rhel} && 0%{?rhel} <= 8 +# LTO builds got enabled on Fedora and RHEL >= 9 only. +%bcond_with lto_build +%else %bcond_without lto_build %endif +%endif -%if %{without lto_build} +# 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 +# RHEL8 still builds with gcc + ld.bfd. +%bcond_with use_lld +%endif + +# For PGO Disable LTO for now because of LLVMgold.so not found error +# Use LLVM_ENABLE_LTO:BOOL=ON flags to enable LTO instead +%if 0%{without lto_build} || 0%{with pgo} %global _lto_cflags %nil %endif # We are building with clang for faster/lower memory LTO builds. # See https://docs.fedoraproject.org/en-US/packaging-guidelines/#_compiler_macros +# Reminder: This only works on Fedora and RHEL >= 9. %global toolchain clang +# Make sure that we are not building with a newer compiler than the targeted +# version. For example, if we build LLVM 19 with Clang 20, then we'd build +# LLVM libraries with Clang 20, and then the runtimes build would use the +# just-built Clang 19. Runtimes that link against LLVM libraries would then +# try to make Clang 19 perform LTO involving LLVM 20 bitcode. +%if %{with compat_build} +%global host_clang_maj_ver %{maj_ver} +%endif -%if %{defined rhel} && 0%{?rhel} < 10 -%global gts_version 14 +%if %{defined host_clang_maj_ver} +%global __cc /usr/bin/clang-%{host_clang_maj_ver} +%global __cxx /usr/bin/clang++-%{host_clang_maj_ver} +%endif + +# The upper bound must remain and never exceed the latest RHEL version with GTS, +# so that this does not apply to ELN or a brand new RHEL version. +%if %{defined rhel} && 0%{?rhel} <= 10 +%global gts_version 15 %endif %if %{defined rhel} && 0%{?rhel} <= 8 @@ -71,49 +259,57 @@ # https://bugzilla.redhat.com/show_bug.cgi?id=2158587 %undefine _include_frame_pointers +# Opt out of https://fedoraproject.org/wiki/Changes/StaticLibraryPreserveDebuginfo +# Debuginfo for LLVM static libraries is huge. +%undefine _preserve_static_debuginfo +# Also make sure find-debuginfo does not waste time on these archives. +# https://bugzilla.redhat.com/show_bug.cgi?id=2390105 +%if 0%{?fedora} >= 43 +%define _find_debuginfo_opts --no-ar-files +%endif + # 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} %else -%global src_tarball_dir llvm-project-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:-rc%{rc_ver}}.src +%global src_tarball_dir llvm-project-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:-%{rc_ver}}.src %endif +# LLD uses "fast" as the algortithm for generating build-id +# values while ld.bfd uses "sha1" by default. We need to get lld +# to use the same algorithm or otherwise we end up with errors like thise one: +# +# "build-id found in [...]/usr/lib64/llvm21/bin/llvm-debuginfod-find too small" +# +# NOTE: Originally this is only needed for PGO but it doesn't hurt to have it on all the time. +%global build_ldflags %{?build_ldflags} -Wl,--build-id=sha1 + #region LLVM globals %if %{with compat_build} %global pkg_name_llvm llvm%{maj_ver} %global pkg_suffix %{maj_ver} %global exec_suffix -%{maj_ver} -%global install_prefix %{_libdir}/%{pkg_name_llvm} -%global install_bindir %{install_prefix}/bin -%global install_includedir %{install_prefix}/include -%global install_libdir %{install_prefix}/lib -%global install_datadir %{install_prefix}/share -%global install_libexecdir %{install_prefix}/libexec -%global install_docdir %{install_datadir}/doc -%global unprefixed_libdir lib -%global build_libdir llvm/%{_vpath_builddir}/lib - -%global pkg_includedir %{_includedir}/%{pkg_name_llvm} -%global pkg_datadir %{install_prefix}/share %else %global pkg_name_llvm llvm -%global install_prefix /usr -%global install_bindir %{_bindir} -%global install_datadir %{_datadir} -%global install_libdir %{_libdir} -%global install_includedir %{_includedir} -%global install_libexecdir %{_libexecdir} -%global install_docdir %{_docdir} -%global unprefixed_libdir %{_lib} -%global build_libdir llvm/%{_vpath_builddir}/%{_lib} -%global pkg_datadir %{_datadir} %global pkg_suffix %{nil} %global exec_suffix %{nil} %endif +# Apart from compiler-rt and libcxx, everything is installed into a +# version-specific prefix. Non-compat packages add symlinks to this prefix. +%global install_prefix %{_libdir}/llvm%{maj_ver} +%global install_bindir %{install_prefix}/bin +%global install_includedir %{install_prefix}/include +%global install_libdir %{install_prefix}/%{_lib} +%global install_datadir %{install_prefix}/share +%global install_mandir %{install_prefix}/share/man +%global install_libexecdir %{install_prefix}/libexec +%global build_libdir llvm/%{_vpath_builddir}/%{_lib} +%global unprefixed_libdir %{_lib} + %if 0%{?rhel} -%global targets_to_build "X86;AMDGPU;PowerPC;NVPTX;SystemZ;AArch64;ARM;Mips;BPF;WebAssembly" +%global targets_to_build "X86;AMDGPU;PowerPC;NVPTX;SystemZ;AArch64;BPF;WebAssembly;RISCV" %global experimental_targets_to_build "" %else %global targets_to_build "all" @@ -157,8 +353,7 @@ # export ASMFLAGS=$CFLAGS #endregion COMPILER-RT globals -#region LLD globals - +#region openmp globals %global pkg_name_libomp libomp%{pkg_suffix} %global so_suffix %{maj_ver}.%{min_ver} @@ -172,23 +367,49 @@ %else %global libomp_arch %{_arch} %endif - -#endregion LLD globals +#endregion openmp globals #region LLD globals %global pkg_name_lld lld%{pkg_suffix} #endregion LLD globals #region LLDB globals -%global pkg_name_lldb lldb +%global pkg_name_lldb lldb%{pkg_suffix} #endregion LLDB globals + +#region MLIR globals +%global pkg_name_mlir mlir%{pkg_suffix} +#endregion MLIR globals + +#region libcxx globals +%global pkg_name_libcxx libcxx +%global pkg_name_libcxxabi libcxxabi +%global pkg_name_llvm_libunwind llvm-libunwind +#endregion libcxx globals + +#region BOLT globals +%global pkg_name_bolt llvm-bolt%{pkg_suffix} +#endregion BOLT globals + +#region polly globals +%global pkg_name_polly polly%{pkg_suffix} +#endregion polly globals + +#region flang globals +%global pkg_name_flang flang%{pkg_suffix} +#endregion flang globals + #endregion globals #region packages #region main package Name: %{pkg_name_llvm} -Version: %{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:~rc%{rc_ver}}%{?llvm_snapshot_version_suffix:~%{llvm_snapshot_version_suffix}} -Release: 2%{?dist} +Version: %{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:~%{rc_ver}}%{?llvm_snapshot_version_suffix:~%{llvm_snapshot_version_suffix}} +%if 0%{?rhel} == 8 +Release: 1%{?dist} +%else +Release: 1%{?dist} +%endif Summary: The Low Level Virtual Machine License: Apache-2.0 WITH LLVM-exception OR NCSA @@ -197,8 +418,8 @@ URL: http://llvm.org %if %{with snapshot_build} Source0: https://github.com/llvm/llvm-project/archive/%{llvm_snapshot_git_revision}.tar.gz %else -Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:-rc%{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%{rc_ver}}/%{src_tarball_dir}.tar.xz.sig +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 %endif Source6: release-keys.asc @@ -217,6 +438,9 @@ Source3001: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{com Source1000: version.spec.inc %endif +# Only used on RHEL-8, where rpmautospec is not available. +Source1001: changelog + # We've established the habit of numbering patches the following way: # # 0-499: All patches that are unconditionally applied @@ -242,15 +466,10 @@ Source1000: version.spec.inc # situations. Remember that a compat library is always at least one major version # behind the latest packaged LLVM version. -#region OpenMP patches -Patch1900: 0001-openmp-Add-option-to-disable-tsan-tests-111548.patch -Patch1901: 0001-openmp-Use-core_siblings_list-if-physical_package_id.patch -#endregion OpenMP patches - #region CLANG patches Patch101: 0001-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch Patch102: 0003-PATCH-clang-Don-t-install-static-libraries.patch -#endregion CLANG patches +Patch2002: 20-131099.patch # Workaround a bug in ORC on ppc64le. # More info is available here: https://reviews.llvm.org/D159115#4641826 @@ -259,40 +478,88 @@ Patch103: 0001-Workaround-a-bug-in-ORC-on-ppc64le.patch # With the introduction of --gcc-include-dir in the clang config file, # this might no longer be needed. Patch104: 0001-Driver-Give-devtoolset-path-precedence-over-Installe.patch +#endregion CLANG patches + +# Fix LLVMConfig.cmake when symlinks are used. +# (https://github.com/llvm/llvm-project/pull/124743 landed in LLVM 21) +Patch2003: 0001-cmake-Resolve-symlink-when-finding-install-prefix.patch #region LLD patches -Patch1800: 0001-18-Always-build-shared-libs-for-LLD.patch -Patch1902: 0001-19-Always-build-shared-libs-for-LLD.patch -Patch2000: 0001-19-Always-build-shared-libs-for-LLD.patch +Patch106: 0001-19-Always-build-shared-libs-for-LLD.patch +Patch2103: 0001-lld-Adjust-compressed-debug-level-test-for-s390x-wit.patch #endregion LLD patches +#region polly patches +Patch2102: 0001-20-polly-shared-libs.patch +Patch2202: 0001-22-polly-shared-libs.patch +Patch2302: 0001-22-polly-shared-libs.patch +#endregion polly patches + #region RHEL patches # RHEL 8 only Patch501: 0001-Fix-page-size-constant-on-aarch64-and-ppc64le.patch +# Backport a fix for https://github.com/llvm/llvm-project/issues/165696 from +# LLVM 22. The first patch is a requirement of the second patch. +# Apply the fix to RHEL8 only because the other distros do not need this fix +# because they already support kfunc __bpf_trap. +Patch502: 0001-BPF-Support-Jump-Table-149715.patch +Patch503: 0002-BPF-Remove-unused-weak-symbol-__bpf_trap-166003.patch +Patch504: 0003-BPF-Remove-dead-code-related-to-__bpf_trap-global-va.patch #endregion RHEL patches -# Backport with modifications from -# https://github.com/llvm/llvm-project/pull/99273 -# Fixes RHEL-49517. -Patch1801: 18-99273.patch +# Fix a pgo miscompilation triggered by building Rust 1.87 with pgo on ppc64le. +# https://github.com/llvm/llvm-project/issues/138208 +Patch2004: 0001-CodeGenPrepare-Make-sure-instruction-get-from-SunkAd.patch +# Related CGP fix for domination, rhbz#2388223 +Patch2008: 0001-CGP-Bail-out-if-Base-Scaled-Reg-does-not-dominate-in.patch -# Fix profiling after a binutils NOTE change. -# https://github.com/llvm/llvm-project/pull/114907 -Patch1802: 0001-profile-Use-base-vaddr-for-__llvm_write_binary_ids-n.patch -Patch1903: 0001-profile-Use-base-vaddr-for-__llvm_write_binary_ids-n.patch +# Fix Power9/Power10 crbit spilling +# https://github.com/llvm/llvm-project/pull/146424 +Patch2007: 21-146424.patch + +# Fix for highway package build on ppc64le +Patch2005: 0001-PowerPC-Fix-handling-of-undefs-in-the-PPC-isSplatShu.patch +Patch2006: 0001-Add-REQUIRES-asserts-to-test-added-in-145149-because.patch + +# Fix for offload builds: The DeviceRTL libraries target device code and +# don't support the mtls-dialect flag, so we need to patch the clang driver +# to ignore it for these targets. +Patch2101: 0001-clang-Add-a-hack-to-fix-the-offload-build-with-the-m.patch +Patch2201: 0001-clang-Add-a-hack-to-fix-the-offload-build-with-the-m.patch + +# Fix segfault compiling plotters rust crate on ppc64le +Patch2104: 0001-PowerPC-Add-check-for-cast-when-shufflevector-172443.patch + +# Fix for lldb python shell with python 3.14 (rbhz#2428608) +Patch2105: 43cb4631c1f42dbfce78288b8ae30b5840ed59b3.patch + +# Fix for s390x vector miscompilation (rhbz#2430017) +Patch2106: 0001-SystemZ-Fix-code-in-widening-vector-multiplication-1.patch %if 0%{?rhel} == 8 %global python3_pkgversion 3.12 %global __python3 /usr/bin/python3.12 %endif +%if %{with fastclang} +# fastclang depends on overriding default conditionals via +# bcond_override_default which is only available on RPM 4.20 and newer. +# More info: +# https://rpm-software-management.github.io/rpm/manual/conditionalbuilds.html#overriding-defaults +BuildRequires: rpm >= 4.20 +%endif %if %{defined gts_version} # Required for 64-bit atomics on i686. BuildRequires: gcc-toolset-%{gts_version}-libatomic-devel +BuildRequires: gcc-toolset-%{gts_version}-gcc-c++ %endif BuildRequires: gcc BuildRequires: gcc-c++ +%if %{defined host_clang_maj_ver} +BuildRequires: clang(major) = %{host_clang_maj_ver} +%else BuildRequires: clang +%endif BuildRequires: cmake BuildRequires: chrpath BuildRequires: ninja-build @@ -300,6 +567,24 @@ BuildRequires: zlib-devel BuildRequires: libzstd-devel BuildRequires: libffi-devel BuildRequires: ncurses-devel + +%if %{with pgo} +%if %{defined host_clang_maj_ver} +BuildRequires: lld(major) = %{host_clang_maj_ver} +BuildRequires: compiler-rt(major) = %{host_clang_maj_ver} +BuildRequires: llvm(major) = %{host_clang_maj_ver} +%else +BuildRequires: lld +BuildRequires: compiler-rt +BuildRequires: llvm +%endif + +%else +%if %{with use_lld} +BuildRequires: lld +%endif +%endif + # 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 @@ -330,8 +615,8 @@ BuildRequires: libedit-devel %endif # We need python3-devel for %%py3_shebang_fix BuildRequires: python%{python3_pkgversion}-devel -BuildRequires: python%{python3_pkgversion}-setuptools %if 0%{?rhel} == 8 +BuildRequires: python%{python3_pkgversion}-setuptools BuildRequires: python%{python3_pkgversion}-rpm-macros %endif @@ -371,6 +656,13 @@ BuildRequires: perl(Term::ANSIColor) BuildRequires: perl(Text::ParseWords) BuildRequires: perl(Sys::Hostname) +%if %{with mlir} +BuildRequires: python%{python3_pkgversion}-numpy +BuildRequires: python%{python3_pkgversion}-pybind11 +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 @@ -379,7 +671,7 @@ BuildRequires: procps-ng # For reproducible pyc file generation # See https://docs.fedoraproject.org/en-US/packaging-guidelines/Python_Appendix/#_byte_compilation_reproducibility # Since Fedora 41 this happens automatically, and RHEL 8 does not support this. -%if %{without compat_build} && ((%{defined fedora} && 0%{?fedora} < 41) || 0%{?rhel} == 9 || 0%{?rhel} == 10) +%if %{without compat_build} && (0%{?rhel} == 9 || 0%{?rhel} == 10) BuildRequires: /usr/bin/marshalparser %global py_reproducible_pyc_path %{buildroot}%{python3_sitelib} %endif @@ -401,7 +693,6 @@ tools as well as libraries with equivalent functionality. Summary: LLVM lit test runner for Python 3 BuildArch: noarch -Requires: python%{python3_pkgversion}-setuptools %if 0%{?rhel} == 8 # Became python3.12-clang in LLVM 19 Obsoletes: python3-lit < 18.9 @@ -417,6 +708,17 @@ lit is a tool used by the LLVM project for executing its test suites. #region LLVM packages +%package -n %{pkg_name_llvm}-filesystem +Summary: Filesystem package that owns the versioned llvm prefix +# Was renamed immediately after introduction. +Obsoletes: %{pkg_name_llvm}-resource-filesystem < 20 +%if %{with compat_build} +Conflicts: llvm-filesystem < %{maj_ver}.99 +%endif + +%description -n %{pkg_name_llvm}-filesystem +This packages owns the versioned llvm prefix directory: $libdir/llvm$version + %package -n %{pkg_name_llvm}-devel Summary: Libraries and header files for LLVM Requires: %{pkg_name_llvm}%{?_isa} = %{version}-%{release} @@ -438,8 +740,8 @@ Requires: %{pkg_name_llvm}-test%{?_isa} = %{version}-%{release} Requires: %{pkg_name_llvm}-googletest%{?_isa} = %{version}-%{release} -Requires(post): %{_sbindir}/alternatives -Requires(postun): %{_sbindir}/alternatives +Requires(post): alternatives +Requires(postun): alternatives Provides: llvm-devel(major) = %{maj_ver} @@ -457,12 +759,14 @@ Documentation for the LLVM compiler infrastructure. %package -n %{pkg_name_llvm}-libs Summary: LLVM shared libraries +Requires: %{pkg_name_llvm}-filesystem%{?_isa} = %{version}-%{release} %description -n %{pkg_name_llvm}-libs Shared libraries for the LLVM compiler infrastructure. %package -n %{pkg_name_llvm}-static Summary: LLVM static libraries +Requires: %{pkg_name_llvm}-filesystem%{?_isa} = %{version}-%{release} Conflicts: %{pkg_name_llvm}-devel < 8 Provides: llvm-static(major) = %{maj_ver} @@ -472,6 +776,7 @@ Static libraries for the LLVM compiler infrastructure. %package -n %{pkg_name_llvm}-cmake-utils Summary: CMake utilities shared across LLVM subprojects +Requires: %{pkg_name_llvm}-filesystem%{?_isa} = %{version}-%{release} %description -n %{pkg_name_llvm}-cmake-utils CMake utilities shared across LLVM subprojects. @@ -488,6 +793,7 @@ Provides: llvm-test(major) = %{maj_ver} LLVM regression tests. %package -n %{pkg_name_llvm}-googletest +Requires: %{pkg_name_llvm}-filesystem%{?_isa} = %{version}-%{release} Summary: LLVM's modified googletest sources %description -n %{pkg_name_llvm}-googletest @@ -543,7 +849,11 @@ Requires: gcc-toolset-%{gts_version}-gcc-c++ Recommends: %{pkg_name_compiler_rt}%{?_isa} = %{version}-%{release} Requires: %{pkg_name_llvm}-libs = %{version}-%{release} # atomic support is not part of compiler-rt +%if %{defined gts_version} +Recommends: gcc-toolset-%{gts_version}-libatomic-devel +%else Recommends: libatomic%{?_isa} +%endif # libomp-devel is required, so clang can find the omp.h header when compiling # with -fopenmp. Recommends: %{pkg_name_libomp}-devel%{_isa} = %{version}-%{release} @@ -558,6 +868,8 @@ Requires: %{pkg_name_clang}-libs = %{version}-%{release} Requires: %{pkg_name_clang}%{?_isa} = %{version}-%{release} # The clang CMake files reference tools from clang-tools-extra. Requires: %{pkg_name_clang}-tools-extra%{?_isa} = %{version}-%{release} +# The clang cmake package depends on the LLVM cmake package. +Requires: %{pkg_name_llvm}-devel%{?_isa} = %{version}-%{release} Provides: clang-devel(major) = %{maj_ver} # For the clangd language server contained in this subpackage, # add a Provides so users can just run "dnf install clangd." @@ -573,6 +885,9 @@ Development header files for clang. %package -n %{pkg_name_clang}-resource-filesystem Summary: Filesystem package that owns the clang resource directory Provides: clang-resource-filesystem(major) = %{maj_ver} +%if %{with compat_build} +Conflicts: clang-resource-filesystem < %{maj_ver}.99 +%endif %description -n %{pkg_name_clang}-resource-filesystem This package owns the clang resouce directory: $libdir/clang/$version/ @@ -580,7 +895,6 @@ This package owns the clang resouce directory: $libdir/clang/$version/ %package -n %{pkg_name_clang}-analyzer Summary: A source code analysis framework License: Apache-2.0 WITH LLVM-exception OR NCSA OR MIT -BuildArch: noarch Requires: %{pkg_name_clang} = %{version}-%{release} %description -n %{pkg_name_clang}-analyzer @@ -626,7 +940,7 @@ Requires: python%{python3_pkgversion} Obsoletes: python3-clang < 18.9 %endif %description -n python%{python3_pkgversion}-clang -%{summary}. +Python3 bindings for clang. %endif @@ -640,7 +954,7 @@ Summary: LLVM "compiler-rt" runtime libraries License: Apache-2.0 WITH LLVM-exception OR NCSA OR MIT -Requires: clang-resource-filesystem%{?_isa} = %{version}-%{release} +Requires: %{pkg_name_clang}-resource-filesystem%{?_isa} = %{version}-%{release} Provides: compiler-rt(major) = %{maj_ver} %description -n %{pkg_name_compiler_rt} @@ -672,7 +986,7 @@ Summary: OpenMP header files URL: http://openmp.llvm.org Requires: %{pkg_name_libomp}%{?_isa} = %{version}-%{release} -Requires: clang-resource-filesystem%{?_isa} = %{version}-%{release} +Requires: %{pkg_name_clang}-resource-filesystem%{?_isa} = %{version}-%{release} Provides: libomp-devel(major) = %{maj_ver} @@ -687,8 +1001,8 @@ URL: http://openmp.llvm.org %package -n %{pkg_name_lld} Summary: The LLVM Linker -Requires(post): %{_sbindir}/update-alternatives -Requires(preun): %{_sbindir}/update-alternatives +Requires(post): alternatives +Requires(preun): alternatives Requires: %{pkg_name_lld}-libs = %{version}-%{release} Provides: lld(major) = %{maj_ver} @@ -724,9 +1038,9 @@ Shared libraries for LLD. %if 0%{?rhel} %package -n %{pkg_name_llvm}-toolset Summary: Package that installs llvm-toolset -Requires: clang = %{version}-%{release} -Requires: llvm = %{version}-%{release} -Requires: lld = %{version}-%{release} +Requires: %{pkg_name_clang} = %{version}-%{release} +Requires: %{pkg_name_llvm} = %{version}-%{release} +Requires: %{pkg_name_lld} = %{version}-%{release} %description -n %{pkg_name_llvm}-toolset This is the main package for llvm-toolset. @@ -741,7 +1055,9 @@ License: Apache-2.0 WITH LLVM-exception OR NCSA URL: http://lldb.llvm.org/ Requires: %{pkg_name_clang}-libs%{?_isa} = %{version}-%{release} +%if %{without compat_build} Requires: python%{python3_pkgversion}-lldb +%endif %description -n %{pkg_name_lldb} LLDB is a next generation, high-performance debugger. It is built as a set @@ -756,8 +1072,8 @@ Requires: %{pkg_name_lldb}%{?_isa} = %{version}-%{release} %description -n %{pkg_name_lldb}-devel The package contains header files for the LLDB debugger. +%if %{without compat_build} %package -n python%{python3_pkgversion}-lldb -%{?python_provide:%python_provide python%{python3_pkgversion}-lldb} Summary: Python module for LLDB Requires: %{pkg_name_lldb}%{?_isa} = %{version}-%{release} @@ -770,7 +1086,206 @@ Obsoletes: python3-lldb < 18.9 %description -n python%{python3_pkgversion}-lldb The package contains the LLDB Python module. %endif +%endif #endregion LLDB packages + +#region MLIR packages +%if %{with mlir} +%package -n %{pkg_name_mlir} +Summary: Multi-Level Intermediate Representation Overview +License: Apache-2.0 WITH LLVM-exception +URL: http://mlir.llvm.org +Requires: %{pkg_name_llvm}-libs = %{version}-%{release} + +%description -n %{pkg_name_mlir} +The MLIR project is a novel approach to building reusable and extensible +compiler infrastructure. MLIR aims to address software fragmentation, +improve compilation for heterogeneous hardware, significantly reduce +the cost of building domain specific compilers, and aid in connecting +existing compilers together. + +%package -n %{pkg_name_mlir}-static +Summary: MLIR static files +Requires: %{pkg_name_mlir}%{?_isa} = %{version}-%{release} + +%description -n %{pkg_name_mlir}-static +MLIR static files. + +%package -n %{pkg_name_mlir}-devel +Summary: MLIR development files +Requires: %{pkg_name_mlir}%{?_isa} = %{version}-%{release} +Requires: %{pkg_name_mlir}-static%{?_isa} = %{version}-%{release} + +%description -n %{pkg_name_mlir}-devel +MLIR development files. + +%package -n python%{python3_pkgversion}-mlir +Summary: MLIR python bindings + +Requires: python%{python3_pkgversion} +Requires: python%{python3_pkgversion}-numpy + +%description -n python%{python3_pkgversion}-mlir +MLIR python bindings. +%endif +#endregion MLIR packages + +#region libcxx packages +%if %{with libcxx} +%package -n %{pkg_name_libcxx} +Summary: C++ standard library targeting C++11 +License: Apache-2.0 WITH LLVM-exception OR MIT OR NCSA +URL: http://libcxx.llvm.org/ + +Requires: %{pkg_name_libcxxabi}%{?_isa} = %{version}-%{release} + +%description -n %{pkg_name_libcxx} +libc++ is a new implementation of the C++ standard library, targeting C++11 and above. + + +%package -n %{pkg_name_libcxx}-devel +Summary: Headers and libraries for %{pkg_name_libcxx} devel +Requires: %{pkg_name_libcxx}%{?_isa} = %{version}-%{release} +Requires: %{pkg_name_libcxxabi}-devel + +%description -n %{pkg_name_libcxx}-devel +Headers and libraries for %{pkg_name_libcxx} devel. + +%package -n %{pkg_name_libcxx}-static +Summary: Static libraries for %{pkg_name_libcxx} + +%description -n %{pkg_name_libcxx}-static +Static libraries for %{pkg_name_libcxx}. + +%package -n %{pkg_name_libcxxabi} +Summary: Low level support for a standard C++ library + +%description -n %{pkg_name_libcxxabi} +libcxxabi provides low level support for a standard C++ library. + +%package -n %{pkg_name_libcxx}abi-devel +Summary: Headers and libraries for %{pkg_name_libcxxabi} devel +Requires: %{pkg_name_libcxxabi}%{?_isa} = %{version}-%{release} + +%description -n %{pkg_name_libcxxabi}-devel +Headers and libraries for %{pkg_name_libcxxabi} devel. + +%package -n %{pkg_name_libcxxabi}-static +Summary: Static libraries for %{pkg_name_libcxxabi} + +%description -n %{pkg_name_libcxxabi}-static +Static libraries for %{pkg_name_libcxxabi}. + +%package -n %{pkg_name_llvm_libunwind} +Summary: LLVM libunwind + +%description -n %{pkg_name_llvm_libunwind} + +LLVM libunwind is an implementation of the interface defined by the HP libunwind +project. It was contributed Apple as a way to enable clang++ to port to +platforms that do not have a system unwinder. It is intended to be a small and +fast implementation of the ABI, leaving off some features of HP's libunwind +that never materialized (e.g. remote unwinding). + +%package -n %{pkg_name_llvm_libunwind}-devel +Summary: LLVM libunwind development files +Provides: %{pkg_name_llvm_libunwind}(major) = %{maj_ver} +Requires: %{pkg_name_llvm_libunwind}%{?_isa} = %{version}-%{release} + +%description -n %{pkg_name_llvm_libunwind}-devel +Unversioned shared library for LLVM libunwind + +%package -n %{pkg_name_llvm_libunwind}-static +Summary: Static library for LLVM libunwind + +%description -n %{pkg_name_llvm_libunwind}-static +Static library for LLVM libunwind. + +%endif +#endregion libcxx packages + +#region BOLT packages +%if %{with build_bolt} +%package -n %{pkg_name_bolt} +Summary: A post-link optimizer developed to speed up large applications +License: Apache-2.0 WITH LLVM-exception +URL: https://github.com/llvm/llvm-project/tree/main/bolt +Requires: %{pkg_name_llvm}-filesystem%{?_isa} = %{version}-%{release} + +# As hinted by bolt documentation +Recommends: gperftools-devel + +%description -n %{pkg_name_bolt} + +BOLT is a post-link optimizer developed to speed up large applications. +It achieves the improvements by optimizing application's code layout based on +execution profile gathered by sampling profiler, such as Linux `perf` tool. +%endif +#endregion BOLT packages + +#region polly packages +%if %{with polly} +%package -n %{pkg_name_polly} +Summary: LLVM Framework for High-Level Loop and Data-Locality Optimizations +License: Apache-2.0 WITH LLVM-exception +URL: http://polly.llvm.org +Requires: %{pkg_name_llvm}-libs = %{version}-%{release} + +# We no longer ship polly-doc. +Obsoletes: %{pkg_name_polly}-doc < 20 + +%description -n %{pkg_name_polly} + +Polly is a high-level loop and data-locality optimizer and optimization +infrastructure for LLVM. It uses an abstract mathematical representation based +on integer polyhedron to analyze and optimize the memory access pattern of a +program. + +%package -n %{pkg_name_polly}-devel +Summary: Polly header files +Requires: %{pkg_name_polly} = %{version}-%{release} + +%description -n %{pkg_name_polly}-devel +Polly header files. +%endif +#endregion polly packages + +#region flang packages +%if %{with flang} +%package -n %{pkg_name_flang} +Summary: a Fortran language front-end designed for integration with LLVM +Requires: %{pkg_name_flang}-runtime%{?_isa} = %{version}-%{release} +# flang installs headers in the clang resource directory +Requires: %{pkg_name_clang}-resource-filesystem%{?_isa} = %{version}-%{release} +# flang implicitly calls ld.bfd when linking and depends on the gcc runtime objects. +Requires: binutils +Requires: gcc +# Up to version 17.0.6-1, flang used to provide a flang-devel package. +# This changed in 17.0.6-2 and all development-related files are now +# distributed in the main flang package. +Obsoletes: %{pkg_name_flang}-devel < 17.0.6-2 + +# We no longer ship flang-doc. +Obsoletes: %{pkg_name_flang}-doc < 22 + +License: Apache-2.0 WITH LLVM-exception +URL: https://flang.llvm.org + +%description -n %{pkg_name_flang} + +Flang is a ground-up implementation of a Fortran front end written in modern +C++. + +%package -n %{pkg_name_flang}-runtime +Summary: Flang runtime libraries +Conflicts: %{pkg_name_flang} < 17.0.6-2 + +%description -n %{pkg_name_flang}-runtime +Flang runtime libraries. + +%endif +#endregion flang packages + #endregion packages #region prep @@ -809,6 +1324,12 @@ The package contains the LLDB Python module. %if %{defined rhel} && 0%{?rhel} == 8 %patch -p1 -P501 +%if %{maj_ver} < 22 +# The following patches have been backported from LLVM 22. +%patch -p1 -P502 +%patch -p1 -P503 +%patch -p1 -P504 +%endif %endif #region LLVM preparation @@ -844,8 +1365,32 @@ The package contains the LLDB Python module. #endregion COMPILER-RT preparation +#region lldb preparation +# 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 +#endregion + +#region libcxx preparation +%if %{with libcxx} +%py3_shebang_fix libcxx/utils/ +%endif +#endregion libcxx preparation + #endregion prep +#region python buildrequires +%if %{with python_lit} +%if 0%{?rhel} != 8 +%generate_buildrequires + +cd llvm/utils/lit +%pyproject_buildrequires +%endif +%endif +#endregion python buildrequires + #region build %build # TODO(kkleine): In clang we had this %ifarch s390 s390x aarch64 %ix86 ppc64le @@ -854,7 +1399,7 @@ The package contains the LLDB Python module. %ifarch %ix86 %global reduce_debuginfo 1 %endif -%if 0%{?rhel} == 8 +%if 0%{?rhel} == 8 || %{with fastclang} %global reduce_debuginfo 1 %endif @@ -864,28 +1409,87 @@ The package contains the LLDB Python module. %endif %global projects clang;clang-tools-extra;lld +%global runtimes compiler-rt;openmp + %if %{with lldb} %global projects %{projects};lldb %endif +%if %{with mlir} +%global projects %{projects};mlir +%endif + +%if %{with build_bolt} +%global projects %{projects};bolt +%endif + +%if %{with polly} +%global projects %{projects};polly +%endif + +%if %{with flang} +%global projects %{projects};flang +%global runtimes %{runtimes};flang-rt +%endif + +%if %{with libcxx} +%global runtimes %{runtimes};libcxx;libcxxabi;libunwind +%endif + +%if %{with offload} +%global runtimes %{runtimes};offload +%endif + +%global gcc_triple --gcc-triple=%{_target_cpu}-redhat-linux + +%global cfg_file_content %{gcc_triple} +%global cfg_file_content_flang %{gcc_triple} + +# We want to use DWARF-5 on all snapshot builds. +%if %{without snapshot_build} && %{defined rhel} && 0%{?rhel} < 10 +%global cfg_file_content %{cfg_file_content} -gdwarf-4 -g0 +%endif + +%if %{defined gts_version} +%global cfg_file_content %{cfg_file_content} --gcc-install-dir=/opt/rh/gcc-toolset-%{gts_version}/root/%{_exec_prefix}/lib/gcc/%{_target_cpu}-redhat-linux/%{gts_version} +%endif + +# Already use the new clang config file for the current build. This ensures +# consistency between the runtimes and non-runtimes builds and makes sure that +# the new configuration will work without going through a rebuild cycle. +# Don't do this on RHEL 8, which does not build using clang. +%if %{defined gts_version} && 0%{?rhel} != 8 +echo "%{cfg_file_content}" > /tmp/clang.cfg +%global optflags %{optflags} --config /tmp/clang.cfg +%endif + # Copy CFLAGS into ASMFLAGS, so -fcf-protection is used when compiling assembly files. 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 +# 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 +# Remember old values to reset to +OLD_PATH="$PATH" +OLD_LD_LIBRARY_PATH="$LD_LIBRARY_PATH" +OLD_CWD="$PWD" + +%global builddir_instrumented $RPM_BUILD_DIR/instrumented-llvm + #region LLVM lit %if %{with python_lit} pushd utils/lit +%if 0%{?rhel} == 8 %py3_build +%else +%pyproject_wheel +%endif popd %endif #endregion LLVM lit @@ -899,12 +1503,54 @@ popd # Common cmake arguments used by both the normal build and bundle_compat_lib. # Any ABI-affecting flags should be in here. %global cmake_common_args \\\ - -DLLVM_ENABLE_EH=ON \\\ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \\\ -DLLVM_ENABLE_RTTI=ON \\\ -DLLVM_USE_PERF=ON \\\ -DLLVM_TARGETS_TO_BUILD=%{targets_to_build} \\\ -DBUILD_SHARED_LIBS=OFF \\\ - -DLLVM_BUILD_LLVM_DYLIB=ON + -DLLVM_BUILD_LLVM_DYLIB=ON \\\ + -DLLVM_LINK_LLVM_DYLIB=ON \\\ + -DCLANG_LINK_CLANG_DYLIB=ON \\\ + -DLLVM_ENABLE_FFI:BOOL=ON + +%if %{maj_ver} >= 22 +%global cmake_common_args %{cmake_common_args} \\\ + -DLLVM_ENABLE_EH=OFF +%else +%global cmake_common_args %{cmake_common_args} \\\ + -DLLVM_ENABLE_EH=ON +%endif + +%if 0%{?rhel} == 8 +# On RHEL 8 we build with gcc, but the runtimes are built with the just built +# clang, so we need to pass clang supported compiler flags to the runtimes +# build. If we pass the gcc flags, some of the cmake feature checkes will +# fail, because they use -Werror and emit an error when passed gcc specific +# compiler flags like -specs. +# Specifically, this is required in order to fix the libomptest.so build. + +function strip_specs { + echo $1 | sed -e 's/-specs=[^ ]\+//g' +} + +CLANG_CC_CONFIG=$(pwd)/redhat-hardened-clang.cfg +CLANG_LD_CONFIG=$(pwd)/redhat-hardened-clang-ld.cfg +echo "-fPIE" >> $CLANG_CC_CONFIG +echo "-pie" >> $CLANG_LD_CONFIG +CLANG_CCFLAGS_EXTRA=--config=$CLANG_CC_CONFIG +CLANG_LDFLAGS_EXTRA=--config=$CLANG_LD_CONFIG + +CLANG_CXXFLAGS=$(strip_specs "$CXXFLAGS $CLANG_CCFLAGS_EXTRA") +CLANG_CFLAGS=$(strip_specs "$CFLAGS $CLANG_CCFLAGS_EXTRA") +CLANG_LDFLAGS=$(strip_specs "$LDFLAGS $CLANG_LDFLAGS_EXTRA") +%global cmake_common_args %{cmake_common_args} \\\ + -DRUNTIMES_CMAKE_ARGS="-DCMAKE_C_FLAGS=$CLANG_C_FLAGS;-DCMAKE_CXX_FLAGS=$CLANG_CXX_FLAGS;-DCMAKE_SHARED_LINKER_FLAGS=$CLANG_LD_FLAGS" +%endif + +%if %reduce_debuginfo == 1 + %global cmake_common_args %{cmake_common_args} -DCMAKE_C_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" + %global cmake_common_args %{cmake_common_args} -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" +%endif %global cmake_config_args %{cmake_common_args} @@ -918,21 +1564,24 @@ popd -DCLANG_ENABLE_STATIC_ANALYZER:BOOL=ON \\\ -DCLANG_INCLUDE_DOCS:BOOL=ON \\\ -DCLANG_INCLUDE_TESTS:BOOL=ON \\\ - -DCLANG_LINK_CLANG_DYLIB=ON \\\ -DCLANG_PLUGIN_SUPPORT:BOOL=ON \\\ -DCLANG_REPOSITORY_STRING="%{?dist_vendor} %{version}-%{release}" \\\ -DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR=../clang-tools-extra + %if %{with compat_build} - %global cmake_config_args %{cmake_config_args} -DCLANG_RESOURCE_DIR=../../../lib/clang/%{maj_ver} +%global cmake_config_args %{cmake_config_args} \\\ + -DCLANG_RESOURCE_DIR=../../../lib/clang/%{maj_ver} %else - %global cmake_config_args %{cmake_config_args} -DCLANG_RESOURCE_DIR=../lib/clang/%{maj_ver} +%global cmake_config_args %{cmake_config_args} \\\ + -DCLANG_RESOURCE_DIR=../lib/clang/%{maj_ver} %endif #endregion clang options #region compiler-rt options %global cmake_config_args %{cmake_config_args} \\\ -DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF \\\ - -DCOMPILER_RT_INSTALL_PATH=%{_prefix}/lib/clang/%{maj_ver} + -DCOMPILER_RT_INSTALL_PATH=%{_prefix}/lib/clang/%{maj_ver} \\\ + -DLLVM_BUILD_EXTERNAL_COMPILER_RT:BOOL=ON #endregion compiler-rt options #region docs options @@ -946,7 +1595,7 @@ popd # Configure sphinx: # Build man-pages but no HTML docs using sphinx %global cmake_config_args %{cmake_config_args} \\\ - -DSPHINX_EXECUTABLE=%{_bindir}/sphinx-build-3 \\\ + -DSPHINX_EXECUTABLE=/usr/bin/sphinx-build-3 \\\ -DSPHINX_OUTPUT_HTML:BOOL=OFF \\\ -DSPHINX_OUTPUT_MAN:BOOL=ON \\\ -DSPHINX_WARNINGS_AS_ERRORS=OFF @@ -954,9 +1603,9 @@ popd #region lldb options %if %{with lldb} - %global cmake_config_args %{cmake_config_args} -DLLDB_DISABLE_CURSES:BOOL=OFF - %global cmake_config_args %{cmake_config_args} -DLLDB_DISABLE_LIBEDIT:BOOL=OFF - %global cmake_config_args %{cmake_config_args} -DLLDB_DISABLE_PYTHON:BOOL=OFF +%if %{with compat_build} + %global cmake_config_args %{cmake_config_args} -DLLDB_ENABLE_PYTHON=OFF +%endif %ifarch ppc64le %global cmake_config_args %{cmake_config_args} -DLLDB_TEST_USER_ARGS=--skip-category=watchpoint %endif @@ -968,44 +1617,125 @@ popd %endif #endregion lldb options +#region libcxx options +%if %{with libcxx} +%global cmake_config_args %{cmake_config_args} \\\ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \\\ + -DLIBCXX_INCLUDE_BENCHMARKS=OFF \\\ + -DLIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY=ON \\\ + -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=ON \\\ + -DLIBCXXABI_USE_LLVM_UNWINDER=OFF \\\ + -DLIBUNWIND_INSTALL_INCLUDE_DIR=%{_includedir}/llvm-libunwind + +# If we don't set the .._INSTALL_LIBRARY_DIR variables, +# the *.so files will be placed in a subdirectory that includes the triple +%global cmake_config_args %{cmake_config_args} \\\ + -DLIBCXX_INSTALL_LIBRARY_DIR=%{_libdir} \\\ + -DLIBCXXABI_INSTALL_LIBRARY_DIR=%{_libdir} \\\ + -DLIBUNWIND_INSTALL_LIBRARY_DIR=%{_libdir} + +# If we don't adjust this, we will install into this unwanted location: +# /usr/include/i686-redhat-linux-gnu/c++/v1/__config_site +%global cmake_config_args %{cmake_config_args} \\\ + -DLIBCXX_INSTALL_INCLUDE_TARGET_DIR=%{_includedir}/c++/v1 \\\ + -DLIBCXX_INSTALL_INCLUDE_DIR=%{_includedir}/c++/v1 \\\ + -DLIBCXX_INSTALL_MODULES_DIR=%{_datadir}/libc++/v1 \\\ + -DLIBCXXABI_INSTALL_INCLUDE_DIR=%{_includedir}/c++/v1 + +%endif +#endregion libcxx options + #region llvm options %global cmake_config_args %{cmake_config_args} \\\ -DLLVM_APPEND_VC_REV:BOOL=OFF \\\ -DLLVM_BUILD_EXAMPLES:BOOL=OFF \\\ - -DLLVM_BUILD_EXTERNAL_COMPILER_RT:BOOL=ON \\\ -DLLVM_BUILD_RUNTIME:BOOL=ON \\\ -DLLVM_BUILD_TOOLS:BOOL=ON \\\ -DLLVM_BUILD_UTILS:BOOL=ON \\\ - -DLLVM_COMMON_CMAKE_UTILS=%{install_datadir}/llvm/cmake \\\ -DLLVM_DEFAULT_TARGET_TRIPLE=%{llvm_triple} \\\ - -DLLVM_DYLIB_COMPONENTS="all" \\\ - -DLLVM_ENABLE_FFI:BOOL=ON \\\ -DLLVM_ENABLE_LIBCXX:BOOL=OFF \\\ -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON \\\ -DLLVM_ENABLE_PROJECTS="%{projects}" \\\ - -DLLVM_ENABLE_RUNTIMES="compiler-rt;openmp;offload" \\\ + -DLLVM_ENABLE_RUNTIMES="%{runtimes}" \\\ -DLLVM_ENABLE_ZLIB:BOOL=FORCE_ON \\\ -DLLVM_ENABLE_ZSTD:BOOL=FORCE_ON \\\ -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=%{experimental_targets_to_build} \\\ -DLLVM_INCLUDE_BENCHMARKS=OFF \\\ - -DLLVM_INCLUDE_EXAMPLES:BOOL=ON \\\ + -DLLVM_INCLUDE_EXAMPLES:BOOL=OFF \\\ -DLLVM_INCLUDE_TOOLS:BOOL=ON \\\ -DLLVM_INCLUDE_UTILS:BOOL=ON \\\ -DLLVM_INSTALL_TOOLCHAIN_ONLY:BOOL=OFF \\\ -DLLVM_INSTALL_UTILS:BOOL=ON \\\ - -DLLVM_LINK_LLVM_DYLIB:BOOL=ON \\\ -DLLVM_PARALLEL_LINK_JOBS=1 \\\ -DLLVM_TOOLS_INSTALL_DIR:PATH=bin \\\ -DLLVM_UNREACHABLE_OPTIMIZE:BOOL=OFF \\\ -DLLVM_UTILS_INSTALL_DIR:PATH=bin #endregion llvm options +#region mlir options +%if %{with mlir} +%global cmake_config_args %{cmake_config_args} \\\ + -DMLIR_INCLUDE_DOCS:BOOL=ON \\\ + -DMLIR_INCLUDE_TESTS:BOOL=ON \\\ + -DMLIR_INCLUDE_INTEGRATION_TESTS:BOOL=OFF \\\ + -DMLIR_INSTALL_AGGREGATE_OBJECTS=OFF \\\ + -DMLIR_BUILD_MLIR_C_DYLIB=ON \\\ + -DMLIR_ENABLE_BINDINGS_PYTHON:BOOL=ON + +%endif +#endregion mlir options + #region openmp options %global cmake_config_args %{cmake_config_args} \\\ -DOPENMP_INSTALL_LIBDIR=%{unprefixed_libdir} \\\ -DLIBOMP_INSTALL_ALIASES=OFF + +%if %{maj_ver} >= 22 && %{with offload} +# 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="" + +%if 0%{?__isa_bits} == 64 +# The following shouldn't be required, but due to a bug, we have to be +# explicit about LLVM_LIBDIR_SUFFIX for nvptx64-nvidia-cuda. +# TODO: Remove this after fixing +# https://github.com/llvm/llvm-project/issues/159762 +%global cmake_config_args %{cmake_config_args} \\\ + -DRUNTIMES_nvptx64-nvidia-cuda_LLVM_LIBDIR_SUFFIX=64 +%endif +%endif #endregion openmp options +#region polly options +%if %{with polly} +%global cmake_config_args %{cmake_config_args} \\\ + -DLLVM_POLLY_LINK_INTO_TOOLS=OFF +%endif +#endregion polly options + +#region flang options +%if %{with flang} +%global cmake_config_args %{cmake_config_args} \\\ + -DFLANG_INCLUDE_DOCS:BOOL=ON +# 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} \\\ + -DFLANG_RT_ENABLE_SHARED:BOOL=ON \\\ + -DFLANG_RT_ENABLE_STATIC:BOOL=ON +# The amount of RAM used per process has been set by trial and error. +# This number may increase/decrease from time to time and may require changes. +# We prefer to be on the safe side in order to avoid spurious errors. +%global cmake_config_args %{cmake_config_args} \\\ + -DFLANG_PARALLEL_COMPILE_JOBS=%{lua: print_max_procs(3072)} +%endif +#endregion flang options + + #region test options %global cmake_config_args %{cmake_config_args} \\\ -DLLVM_BUILD_TESTS:BOOL=ON \\\ @@ -1014,22 +1744,21 @@ popd -DLLVM_LIT_ARGS="-vv" %if %{with lto_build} -%if 0%{?fedora} >= 41 %global cmake_config_args %{cmake_config_args} -DLLVM_UNITTEST_LINK_FLAGS="-fno-lto" -%else - %global cmake_config_args %{cmake_config_args} -DLLVM_UNITTEST_LINK_FLAGS="-Wl,-plugin-opt=O0" -%endif %endif #endregion test options #region misc options %global cmake_config_args %{cmake_config_args} \\\ - -DCMAKE_BUILD_TYPE=RelWithDebInfo \\\ -DCMAKE_INSTALL_PREFIX=%{install_prefix} \\\ -DENABLE_LINKER_BUILD_ID:BOOL=ON \\\ - -DOFFLOAD_INSTALL_LIBDIR=%{unprefixed_libdir} \\\ -DPython3_EXECUTABLE=%{__python3} +%if %{with offload} +%global cmake_config_args %{cmake_config_args} \\\ + -DOFFLOAD_INSTALL_LIBDIR=%{unprefixed_libdir} +%endif + # During the build, we use both the system clang and the just-built clang, and # they need to use the system and just-built shared objects respectively. If # we use LD_LIBRARY_PATH to point to our build directory, the system clang @@ -1043,17 +1772,8 @@ popd %global cmake_config_args %{cmake_config_args} -DPPC_LINUX_DEFAULT_IEEELONGDOUBLE=ON %endif -%if %reduce_debuginfo == 1 - %global cmake_config_args %{cmake_config_args} -DCMAKE_C_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" - %global cmake_config_args %{cmake_config_args} -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" -%endif - -%if %{without compat_build} %if 0%{?__isa_bits} == 64 %global cmake_config_args %{cmake_config_args} -DLLVM_LIBDIR_SUFFIX=64 -%else - %global cmake_config_args %{cmake_config_args} -DLLVM_LIBDIR_SUFFIX= -%endif %endif %if %{with gold} @@ -1077,7 +1797,11 @@ popd # This option uses the NUMBER_OF_LOGICAL_CORES query in CMake which doesn't # work on s390x. # https://gitlab.kitware.com/cmake/cmake/-/issues/26619 - %global cmake_config_args %{cmake_config_args} -DLLVM_RAM_PER_COMPILE_JOB=2048 + # The value 4096 was used after we've seen cases of memory exhaustion on a + # system with 64GiB RAM and 16 jobs. It worked a few times after applied, + # but we can't guarantee it's enough. It's important to remember that RHEL8 + # uses GCC. This value should not be applied to a build using clang. + %global cmake_config_args %{cmake_config_args} -DLLVM_RAM_PER_COMPILE_JOB=4096 %endif %endif #endregion misc options @@ -1090,7 +1814,131 @@ if grep 'flags.*la57' /proc/cpuinfo; then fi #endregion cmake options -%cmake -G Ninja %cmake_config_args $extra_cmake_args +%if %{with pgo} +#region Instrument LLVM +%global __cmake_builddir %{builddir_instrumented} + +# For -Wno-backend-plugin see https://llvm.org/docs/HowToBuildWithPGO.html +#%%global optflags_for_instrumented %(echo %{optflags} -Wno-backend-plugin) + +%global cmake_config_args_instrumented %{cmake_config_args} \\\ + -DLLVM_ENABLE_PROJECTS:STRING="clang;lld" \\\ + -DLLVM_ENABLE_RUNTIMES="compiler-rt" \\\ + -DLLVM_TARGETS_TO_BUILD=Native \\\ + -DCMAKE_BUILD_TYPE:STRING=Release \\\ + -DCMAKE_INSTALL_PREFIX=%{builddir_instrumented} \\\ + -DCLANG_INCLUDE_DOCS:BOOL=OFF \\\ + -DLLVM_BUILD_DOCS:BOOL=OFF \\\ + -DLLVM_BUILD_UTILS:BOOL=OFF \\\ + -DLLVM_ENABLE_DOXYGEN:BOOL=OFF \\\ + -DLLVM_ENABLE_SPHINX:BOOL=OFF \\\ + -DLLVM_INCLUDE_DOCS:BOOL=OFF \\\ + -DLLVM_INCLUDE_TESTS:BOOL=OFF \\\ + -DLLVM_INSTALL_UTILS:BOOL=OFF \\\ + -DCLANG_BUILD_EXAMPLES:BOOL=OFF \\\ + \\\ + -DLLVM_BUILD_INSTRUMENTED=IR \\\ + -DLLVM_BUILD_RUNTIME=No \\\ + -DLLVM_ENABLE_LTO:BOOL=Thin \\\ + -DLLVM_USE_LINKER=lld + +# CLANG_INCLUDE_TESTS=ON is needed to make the target "generate-profdata" available +%global cmake_config_args_instrumented %{cmake_config_args_instrumented} \\\ + -DCLANG_INCLUDE_TESTS:BOOL=ON + +# LLVM_INCLUDE_UTILS=ON is needed because the tests enabled by CLANG_INCLUDE_TESTS=ON +# require "FileCheck", "not", "count", etc. +%global cmake_config_args_instrumented %{cmake_config_args_instrumented} \\\ + -DLLVM_INCLUDE_UTILS:BOOL=ON + +# LLVM Profile Warning: Unable to track new values: Running out of static counters. +# Consider using option -mllvm -vp-counters-per-site= to allocate more value profile +# counters at compile time. +%global cmake_config_args_instrumented %{cmake_config_args_instrumented} \\\ + -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} +%else +%global cmake_config_args_instrumented %{cmake_config_args_instrumented} \\\ + -DLLVM_PROFDATA=%{_bindir}/llvm-profdata +%endif + +# TODO(kkleine): Should we see warnings like: +# "function control flow change detected (hash mismatch)" +# then read https://issues.chromium.org/issues/40633598 again. +%cmake -G Ninja %{cmake_config_args_instrumented} $extra_cmake_args + +# Build all the tools we need in order to build generate-profdata and llvm-profdata +%cmake_build --target libclang-cpp.so +%cmake_build --target clang +%cmake_build --target lld +%cmake_build --target llvm-ar +%cmake_build --target llvm-ranlib +#endregion Instrument LLVM + +#region Perf training +%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 + +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 + +#region Final stage + +#region reset paths and globals +function reset_paths { + export PATH="$OLD_PATH" + export LD_LIBRARY_PATH="$OLD_LD_LIBRARY_PATH" +} +reset_paths + +cd $OLD_CWD +%global _vpath_srcdir . +%global __cmake_builddir %{_vpath_builddir} +#endregion reset paths and globals + +%global extra_cmake_opts %{nil} + +%if %{with pgo} + %global extra_cmake_opts %{extra_cmake_opts} -DLLVM_PROFDATA_FILE=$RPM_BUILD_DIR/result.profdata + # There were a couple of errors that I ran into. One basically said: + # + # Error: LLVM Profile Warning: Unable to track new values: Running out of + # static counters. Consider using option -mllvm -vp-counters-per-site= to + # allocate more value profile counters at compile time. + # + # As a solution I’ve added the --vp-counters-per-site option but this resulted + # in a follow-up error: + # + # Error: clang (LLVM option parsing): for the --vp-counters-per-site option: + # may only occur zero or one times! + # + # The solution was to modify vp-counters-per-site option through + # LLVM_VP_COUNTERS_PER_SITE instead of adding it, hence the + # -DLLVM_VP_COUNTERS_PER_SITE=8. + %global extra_cmake_opts %{extra_cmake_opts} -DLLVM_VP_COUNTERS_PER_SITE=8 +%endif + +%if 0%{with lto_build} + %global extra_cmake_opts %{extra_cmake_opts} -DLLVM_ENABLE_LTO:BOOL=Thin + %global extra_cmake_opts %{extra_cmake_opts} -DLLVM_ENABLE_FATLTO=ON +%endif + +%if 0%{with use_lld} +%global extra_cmake_opts %{extra_cmake_opts} -DLLVM_USE_LINKER=lld +%endif + +%cmake -G Ninja %{cmake_config_args} %{extra_cmake_opts} $extra_cmake_args # Build libLLVM.so first. This ensures that when libLLVM.so is linking, there # are no other compile jobs running. This will help reduce OOM errors on the @@ -1101,6 +1949,13 @@ fi # This is to fix occasional OOM errors on the ppc64le COPR builders. %cmake_build --target libclang-cpp.so +# Same for the three large MLIR dylibs. +%if %{with mlir} +%cmake_build --target libMLIR.so +%cmake_build --target libMLIR-C.so +%cmake_build --target libMLIRPythonCAPI.so +%endif + %cmake_build # If we don't build the runtimes target here, we'll have to wait for the %%check @@ -1109,21 +1964,44 @@ fi # /usr/lib64/libomptarget.devicertl.a # /usr/lib64/libomptarget-amdgpu-*.bc # /usr/lib64/libomptarget-nvptx-*.bc - %cmake_build --target runtimes +#endregion Final stage + +%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 .. %if %{with bundle_compat_lib} + +%if %{compat_maj_ver} >= 22 +%global compat_lib_cmake_args -DLLVM_ENABLE_EH=OFF +%else +%global compat_lib_cmake_args -DLLVM_ENABLE_EH=ON +%endif + +# MIPS and Arm targets were disabled in LLVM 20, but we still need them +# enabled for the compat libraries. %cmake -S ../llvm-project-%{compat_ver}.src/llvm -B ../llvm-compat-libs -G Ninja \ -DCMAKE_INSTALL_PREFIX=%{buildroot}%{_libdir}/llvm%{compat_maj_ver}/ \ -DCMAKE_SKIP_RPATH=ON \ - -DCMAKE_BUILD_TYPE=Release \ -DLLVM_ENABLE_PROJECTS="clang;lldb" \ -DLLVM_INCLUDE_BENCHMARKS=OFF \ -DLLVM_INCLUDE_TESTS=OFF \ - %{cmake_common_args} + %{cmake_common_args} \ + %{compat_lib_cmake_args} + + %ninja_build -C ../llvm-compat-libs LLVM %ninja_build -C ../llvm-compat-libs libclang.so @@ -1142,7 +2020,11 @@ pushd llvm %if %{with python_lit} pushd utils/lit +%if 0%{?rhel} == 8 %py3_install +%else +%pyproject_install +%endif # Strip out #!/usr/bin/env python sed -i -e '1{\@^#!/usr/bin/env python@d}' %{buildroot}%{python3_sitelib}/lit/*.py @@ -1151,6 +2033,14 @@ popd %cmake_install +%if %{with flang} +# Create ld.so.conf.d entry +mkdir -p %{buildroot}%{_sysconfdir}/ld.so.conf.d +cat >> %{buildroot}%{_sysconfdir}/ld.so.conf.d/%{pkg_name_flang}-%{_arch}.conf << EOF +%{_prefix}/lib/clang/%{maj_ver}/lib/%{llvm_triple}/ +EOF +%endif + popd mkdir -p %{buildroot}/%{_bindir} @@ -1173,9 +2063,6 @@ install %{build_libdir}/libLLVMTestingAnnotations.a %{buildroot}%{install_libdir %if %{without compat_build} -# Fix some man pages -ln -s llvm-config.1 %{buildroot}%{_mandir}/man1/llvm-config%{exec_suffix}-%{__isa_bits}.1 - %if %{with gold} # Add symlink to lto plugin in the binutils plugin directory. %{__mkdir_p} %{buildroot}%{_libdir}/bfd-plugins/ @@ -1190,17 +2077,10 @@ cat >> %{buildroot}%{_sysconfdir}/ld.so.conf.d/%{pkg_name_llvm}-%{_arch}.conf << %{install_libdir} EOF -# Add version suffix to man pages and move them to mandir. -mkdir -p %{buildroot}/%{_mandir}/man1 -for f in %{build_install_prefix}/share/man/man1/*; do - filename=`basename $f | cut -f 1 -d '.'` - mv $f %{buildroot}%{_mandir}/man1/$filename%{exec_suffix}.1 -done - %endif -mkdir -p %{buildroot}%{pkg_datadir}/llvm/cmake -cp -Rv cmake/* %{buildroot}%{pkg_datadir}/llvm/cmake +mkdir -p %{buildroot}%{install_datadir}/llvm-cmake +cp -Rv cmake/* %{buildroot}%{install_datadir}/llvm-cmake # Install a placeholder to redirect users of the formerly shipped # HTML documentation to the upstream HTML documentation. @@ -1235,8 +2115,13 @@ EOF #region CLANG installation -# Add a symlink in /usr/bin to clang-format-diff -ln -s %{install_datadir}/clang/clang-format-diff.py %{buildroot}%{install_bindir}/clang-format-diff +# Add a symlink in bindir to clang-format-diff +ln -s ../share/clang/clang-format-diff.py %{buildroot}%{install_bindir}/clang-format-diff + +# Install the PGO profile that was used to build this LLVM into the clang package +%if 0%{with pgo} +cp -v $RPM_BUILD_DIR/result.profdata %{buildroot}%{install_datadir}/llvm-pgo.profdata +%endif # File in the macros file for other packages to use. We are not doing this # in the compat package, because the version macros would # conflict with @@ -1258,7 +2143,7 @@ install -p -m644 clang/bindings/python/clang/* %{buildroot}%{python3_sitelib}/cl %py_byte_compile %{__python3} %{buildroot}%{python3_sitelib}/clang # install scanbuild-py to python sitelib. -mv %{buildroot}%{_prefix}/lib/{libear,libscanbuild} %{buildroot}%{python3_sitelib} +mv %{buildroot}%{install_prefix}/lib/{libear,libscanbuild} %{buildroot}%{python3_sitelib} # Cannot use {libear,libscanbuild} style expansion in py_byte_compile. %py_byte_compile %{__python3} %{buildroot}%{python3_sitelib}/libear %py_byte_compile %{__python3} %{buildroot}%{python3_sitelib}/libscanbuild @@ -1266,37 +2151,22 @@ mv %{buildroot}%{_prefix}/lib/{libear,libscanbuild} %{buildroot}%{python3_siteli # Move emacs integration files to the correct directory mkdir -p %{buildroot}%{_emacs_sitestartdir} for f in clang-format.el clang-include-fixer.el; do -mv %{buildroot}{%{_datadir}/clang,%{_emacs_sitestartdir}}/$f +mv %{buildroot}{%{install_datadir}/clang,%{_emacs_sitestartdir}}/$f done -%if %{maj_ver} < 20 -mv %{buildroot}{%{_datadir}/clang,%{_emacs_sitestartdir}}/clang-rename.el -%endif - -# Add clang++-{version} symlink -ln -s clang++ %{buildroot}%{_bindir}/clang++-%{maj_ver} %else -# Fix permission -chmod u-x %{buildroot}%{_mandir}/man1/scan-build%{exec_suffix}.1* - # Not sure where to put these python modules for the compat build. -rm -Rf %{buildroot}%{install_libdir}/{libear,libscanbuild} +rm -Rf %{buildroot}%{install_prefix}/lib/{libear,libscanbuild} +rm %{buildroot}%{install_bindir}/scan-build-py # Not sure where to put the emacs integration files for the compat build. rm -Rf %{buildroot}%{install_datadir}/clang/*.el -# Add clang++-{version} symlink -ln -s clang++ %{buildroot}%{install_bindir}/clang++-%{maj_ver} - %endif -# Create Manpage symlinks -ln -s clang%{exec_suffix}.1.gz %{buildroot}%{_mandir}/man1/clang++%{exec_suffix}.1.gz -%if %{without compat_build} -ln -s clang.1.gz %{buildroot}%{_mandir}/man1/clang-%{maj_ver}.1.gz -ln -s clang.1.gz %{buildroot}%{_mandir}/man1/clang++-%{maj_ver}.1.gz -%endif +# Create manpage symlink for clang++ +ln -s clang-%{maj_ver}.1 %{buildroot}%{install_mandir}/man1/clang++.1 # Fix permissions of scan-view scripts chmod a+x %{buildroot}%{install_datadir}/scan-view/{Reporter.py,startfile.py} @@ -1309,33 +2179,23 @@ 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/clang-doc-default-stylesheet.css -rm -Rvf %{buildroot}%{install_datadir}/clang-doc/index.js +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 -# Create sub-directories in the clang resource directory that will be -# populated by other packages +%if %{without compat_build} +# Move clang resource directory to default prefix. +mkdir -p %{buildroot}%{_prefix}/lib/clang +mv %{buildroot}%{install_prefix}/lib/clang/%{maj_ver} %{buildroot}%{_prefix}/lib/clang/%{maj_ver} +%endif +# Create any missing sub-directories in the clang resource directory. mkdir -p %{buildroot}%{_prefix}/lib/clang/%{maj_ver}/{bin,include,lib,share}/ # Add versioned resource directory macro mkdir -p %{buildroot}%{_rpmmacrodir}/ echo "%%clang%{maj_ver}_resource_dir %%{_prefix}/lib/clang/%{maj_ver}" >> %{buildroot}%{_rpmmacrodir}/macros.%{pkg_name_clang} -# Install config file for clang -%if %{maj_ver} >=18 -%global cfg_file_content --gcc-triple=%{_target_cpu}-redhat-linux - -# We want to use DWARF-5 on all snapshot builds. -%if %{without snapshot_build} && %{defined rhel} && 0%{?rhel} < 10 -%global cfg_file_content %{cfg_file_content} -gdwarf-4 -g0 -%endif - -%if %{defined gts_version} -%global cfg_file_content %{cfg_file_content} --gcc-install-dir=/opt/rh/gcc-toolset-%{gts_version}/root/%{_exec_prefix}/lib/gcc/%{_target_cpu}-redhat-linux/%{gts_version} -%endif - mkdir -p %{buildroot}%{_sysconfdir}/%{pkg_name_clang}/ echo " %{cfg_file_content}" >> %{buildroot}%{_sysconfdir}/%{pkg_name_clang}/%{_target_platform}-clang.cfg echo " %{cfg_file_content}" >> %{buildroot}%{_sysconfdir}/%{pkg_name_clang}/%{_target_platform}-clang++.cfg @@ -1344,7 +2204,6 @@ echo " %{cfg_file_content}" >> %{buildroot}%{_sysconfdir}/%{pkg_name_clang}/%{_t echo " %{cfg_file_content}" >> %{buildroot}%{_sysconfdir}/%{pkg_name_clang}/i386-redhat-linux-gnu-clang.cfg echo " %{cfg_file_content}" >> %{buildroot}%{_sysconfdir}/%{pkg_name_clang}/i386-redhat-linux-gnu-clang++.cfg %endif -%endif #endregion CLANG installation @@ -1358,7 +2217,8 @@ echo " %{cfg_file_content}" >> %{buildroot}%{_sysconfdir}/%{pkg_name_clang}/i386 %ifarch ppc64le # Fix install path on ppc64le so that the directory name matches the triple used # by clang. -mv %{buildroot}%{_prefix}/lib/clang/%{maj_ver}/lib/powerpc64le-redhat-linux-gnu %{buildroot}%{_prefix}/lib/clang/%{maj_ver}/lib/%{llvm_triple} +mkdir -pv %{buildroot}%{_prefix}/lib/clang/%{maj_ver}/lib/%{llvm_triple} +mv %{buildroot}%{_prefix}/lib/clang/%{maj_ver}/lib/powerpc64le-redhat-linux-gnu/* %{buildroot}%{_prefix}/lib/clang/%{maj_ver}/lib/%{llvm_triple} %endif %ifarch %{ix86} @@ -1383,13 +2243,9 @@ rm -rf %{buildroot}/%{install_datadir}/gdb # chmod go+w %{buildroot}/%{_datarootdir}/gdb/python/ompd/ompdModule.so # chmod +w %{buildroot}/%{_datarootdir}/gdb/python/ompd/ompdModule.so -%ifnarch %{ix86} +%if %{with offload} # Remove files that we don't package, yet. -%if %{maj_ver} >= 20 rm %{buildroot}%{install_bindir}/llvm-offload-device-info -%else -rm %{buildroot}%{install_bindir}/llvm-omp-device-info -%endif rm %{buildroot}%{install_bindir}/llvm-omp-kernel-replay %endif @@ -1401,60 +2257,192 @@ rm %{buildroot}%{install_bindir}/llvm-omp-kernel-replay # Required when using update-alternatives: # https://docs.fedoraproject.org/en-US/packaging-guidelines/Alternatives/ touch %{buildroot}%{_bindir}/ld - -install -D -m 644 -t %{buildroot}%{_mandir}/man1/ lld/docs/ld.lld.1 %endif +install -D -m 644 -t %{buildroot}%{install_mandir}/man1/ lld/docs/ld.lld.1 + #endregion LLD installation #region LLDB installation %if %{with lldb} %multilib_fix_c_header --file %{install_includedir}/lldb/Host/Config.h +%if %{without compat_build} +# Move python package out of llvm prefix. +mkdir -p %{buildroot}%{python3_sitearch} +mv %{buildroot}%{install_prefix}/%{_lib}/python%{python3_version}/site-packages/lldb %{buildroot}/%{python3_sitearch} +rmdir %{buildroot}%{install_prefix}/%{_lib}/python%{python3_version}/site-packages +rmdir %{buildroot}%{install_prefix}/%{_lib}/python%{python3_version} + # python: fix binary libraries location -liblldb=$(basename $(readlink -e %{buildroot}%{_libdir}/liblldb.so)) +liblldb=$(basename $(readlink -e %{buildroot}%{install_libdir}/liblldb.so)) ln -vsf "../../../${liblldb}" %{buildroot}%{python3_sitearch}/lldb/_lldb.so %py_byte_compile %{__python3} %{buildroot}%{python3_sitearch}/lldb %endif +%endif #endregion LLDB installation -%if %{with compat_build} -# Add version suffix to binaries. Do this at the end so it includes any -# additional binaries that may be been added by other steps. -for f in %{buildroot}/%{install_bindir}/*; do - filename=`basename $f` - if echo $filename | grep -e '%{maj_ver}'; then - continue - fi - ln -s ../../%{install_bindir}/$filename %{buildroot}/%{_bindir}/$filename%{exec_suffix} -done +#region mlir installation +%if %{with mlir} +mkdir -p %{buildroot}/%{python3_sitearch} +mv %{buildroot}%{install_prefix}/python_packages/mlir_core/mlir %{buildroot}/%{python3_sitearch} +# These directories should be empty now. +rmdir %{buildroot}%{install_prefix}/python_packages/mlir_core %{buildroot}%{install_prefix}/python_packages +# Unneeded files. +rm -rf %{buildroot}%{install_prefix}/src/python +%endif +#endregion mlir installation + +#region flang installation +%if %{with flang} +# Remove unnecessary files. +rm -rfv %{buildroot}%{install_libdir}/cmake/flang + +# Remove runtime development headers (see https://github.com/llvm/llvm-project/pull/165610) +rm -rfv %{buildroot}%{install_includedir}/flang-rt + +rm -v %{buildroot}%{install_libdir}/libFIRAnalysis.a \ + %{buildroot}%{install_libdir}/libFIRBuilder.a \ + %{buildroot}%{install_libdir}/libFIRCodeGen.a \ + %{buildroot}%{install_libdir}/libFIRCodeGenDialect.a \ + %{buildroot}%{install_libdir}/libFIRDialect.a \ + %{buildroot}%{install_libdir}/libFIRDialectSupport.a \ + %{buildroot}%{install_libdir}/libFIROpenACCSupport.a \ + %{buildroot}%{install_libdir}/libFIROpenMPSupport.a \ + %{buildroot}%{install_libdir}/libFIRSupport.a \ + %{buildroot}%{install_libdir}/libFIRTestAnalysis.a \ + %{buildroot}%{install_libdir}/libFIRTestOpenACCInterfaces.a \ + %{buildroot}%{install_libdir}/libFIRTransforms.a \ + %{buildroot}%{install_libdir}/libflangFrontend.a \ + %{buildroot}%{install_libdir}/libflangFrontendTool.a \ + %{buildroot}%{install_libdir}/libflangPasses.a \ + %{buildroot}%{install_libdir}/libFlangOpenMPTransforms.a \ + %{buildroot}%{install_libdir}/libFortranEvaluate.a \ + %{buildroot}%{install_libdir}/libFortranLower.a \ + %{buildroot}%{install_libdir}/libFortranParser.a \ + %{buildroot}%{install_libdir}/libFortranSemantics.a \ + %{buildroot}%{install_libdir}/libFortranSupport.a \ + %{buildroot}%{install_libdir}/libHLFIRDialect.a \ + %{buildroot}%{install_libdir}/libHLFIRTransforms.a \ + %{buildroot}%{install_libdir}/libCUFAttrs.a \ + %{buildroot}%{install_libdir}/libCUFDialect.a \ + %{buildroot}%{install_libdir}/libFortranDecimal.a +%if %{maj_ver} >= 22 +rm -v %{buildroot}%{install_libdir}/libFortranUtils.a \ + %{buildroot}%{install_libdir}/libFIROpenACCAnalysis.a \ + %{buildroot}%{install_libdir}/libFIROpenACCTransforms.a \ + %{buildroot}%{install_libdir}/libMIFDialect.a %endif -# llvm-config special casing. llvm-config is managed by update-alternatives. -# the original file must remain available for compatibility with the CMake -# infrastructure. Without compat, cmake points to the symlink, with compat it -# points to the original file. +find %{buildroot}%{install_includedir}/flang -type f -a ! -iname '*.mod' -delete + +# this is a test binary +rm -v %{buildroot}%{install_bindir}/f18-parse-demo + +# Probably this directory already existed before +mkdir -pv %{buildroot}%{_sysconfdir}/%{pkg_name_clang}/ +echo " %{cfg_file_content_flang}" >> %{buildroot}%{_sysconfdir}/%{pkg_name_clang}/%{_target_platform}-flang.cfg +%ifarch x86_64 +# On x86_64, install an additional config file. +echo " %{cfg_file_content_flang}" >> %{buildroot}%{_sysconfdir}/%{pkg_name_clang}/i386-redhat-linux-gnu-flang.cfg +%endif +%endif +#endregion flang installation + +#region libcxx installation +%if %{with libcxx} +# We can't install the unversionned path on default location because that would conflict with +# https://src.fedoraproject.org/rpms/libunwind +# +# The versionned path has a different soname (libunwind.so.1 compared to +# libunwind.so.8) so they can live together in %%{_libdir} +# +# ABI wise, even though llvm-libunwind's library is named libunwind, it doesn't +# have the exact same ABI as gcc's libunwind (it actually provides a subset). +rm %{buildroot}%{_libdir}/libunwind.so +mkdir -p %{buildroot}/%{_libdir}/llvm-unwind/ + +pushd %{buildroot}/%{_libdir}/llvm-unwind +ln -s ../libunwind.so.1.0 libunwind.so +popd +%endif +#endregion libcxx installation + +#region BOLT installation +# We don't ship libLLVMBOLT*.a +rm -f %{buildroot}%{install_libdir}/libLLVMBOLT*.a +#endregion BOLT installation + +# Move files from src to dest and replace the old files in src with relative +# symlinks. +move_and_replace_with_symlinks() { + local src="$1" + local dest="$2" + mkdir -p "$dest" + + # Change to source directory to simplify relative paths + (cd "$src" && \ + find * -type d -exec mkdir -p "$dest/{}" \; && \ + find * \( -type f -o -type l \) -exec mv "$src/{}" "$dest/{}" \; \ + -exec ln -s --relative "$dest/{}" "$src/{}" \;) +} %if %{without compat_build} - -mv %{buildroot}/%{install_bindir}/llvm-config %{buildroot}/%{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} -# We still maintain a versionned symlink for consistency across llvm versions. -# This is specific to the non-compat build and matches the exec prefix for -# compat builds. An isa-agnostic versionned symlink is also maintained in the (un)install -# steps. -(cd %{buildroot}/%{install_bindir} ; ln -s llvm-config%{exec_suffix}-%{__isa_bits} llvm-config-%{maj_ver}-%{__isa_bits} ) -# ghost presence -touch %{buildroot}%{_bindir}/llvm-config-%{maj_ver} - -%else - -rm %{buildroot}%{_bindir}/llvm-config%{exec_suffix} -(cd %{buildroot}/%{install_bindir} ; ln -s llvm-config llvm-config%{exec_suffix}-%{__isa_bits} ) - +# 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 +# would conflict otherwise. +move_and_replace_with_symlinks %{buildroot}%{install_bindir} %{buildroot}%{_bindir} +move_and_replace_with_symlinks %{buildroot}%{install_libdir} %{buildroot}%{_libdir} +move_and_replace_with_symlinks %{buildroot}%{install_libexecdir} %{buildroot}%{_libexecdir} +move_and_replace_with_symlinks %{buildroot}%{install_includedir} %{buildroot}%{_includedir} +move_and_replace_with_symlinks %{buildroot}%{install_datadir} %{buildroot}%{_datadir} %endif -# ghost presence -touch %{buildroot}%{_bindir}/llvm-config%{exec_suffix} +# Create versioned symlinks for binaries. +# Do this at the end so it includes any files added by preceding steps. +mkdir -p %{buildroot}%{_bindir} +for f in %{buildroot}%{install_bindir}/*; do + filename=`basename $f` + if [[ "$filename" =~ ^(lit|ld|clang-%{maj_ver}|flang-%{maj_ver})$ ]]; then + continue + fi + %if %{with compat_build} + ln -s ../../%{install_bindir}/$filename %{buildroot}/%{_bindir}/$filename-%{maj_ver} + %else + # clang-NN and flang-NN are already created by the build system. + if [[ "$filename" =~ ^(clang|flang)$ ]]; then + continue + fi + ln -s $filename %{buildroot}/%{_bindir}/$filename-%{maj_ver} + %endif +done + +mkdir -p %{buildroot}%{_mandir}/man1 +for f in %{buildroot}%{install_mandir}/man1/*; do + filename=`basename $f` + filename=${filename%.1} + %if %{with compat_build} + # Move man pages to system install prefix. + mv $f %{buildroot}%{_mandir}/man1/$filename-%{maj_ver}.1 + %else + # Create suffixed symlink. + ln -s $filename.1 %{buildroot}%{_mandir}/man1/$filename-%{maj_ver}.1 + %endif +done +rm -rf %{buildroot}%{install_mandir} + +# As an exception, always keep llvm-config in the versioned prefix. +# The llvm-config in the default prefix will be managed by alternatives. +%if %{without compat_build} +rm %{buildroot}%{install_bindir}/llvm-config +mv %{buildroot}%{_bindir}/llvm-config %{buildroot}%{install_bindir}/llvm-config +%endif + +# ghost presence for llvm-config, managed by alternatives. +touch %{buildroot}%{_bindir}/llvm-config-%{maj_ver} +%if %{without compat_build} +touch %{buildroot}%{_bindir}/llvm-config +%endif %if %{with bundle_compat_lib} install -m 0755 ../llvm-compat-libs/lib/libLLVM.so.%{compat_maj_ver}* %{buildroot}%{_libdir} @@ -1469,6 +2457,22 @@ install -m 0755 ../llvm-compat-libs/lib/liblldb.so.%{compat_maj_ver}* %{buildroo # TODO(kkleine): Instead of deleting test files we should mark them as expected # to fail. See https://llvm.org/docs/CommandGuide/lit.html#cmdoption-lit-xfail +# Tell if the GTS version used by the newly built clang is equal to the +# expected version. +function is_gts_equal { + local gts_used=$(`pwd`/%{_vpath_builddir}/bin/clang -v 2>&1 | grep "Selected GCC installation" | sed 's|.*/\([0-9]\+\)$|\1|') + if [[ -z "%{gts_version}" ]]; then + return 0 + fi + test "x$gts_used" = "x%{gts_version}" + return $? +} + +# Increase open file limit while running tests. +if [[ $(ulimit -n) -lt 10000 ]]; then + ulimit -n 10000 +fi + %ifarch ppc64le # TODO: Re-enable when ld.gold fixed its internal error. rm llvm/test/tools/gold/PowerPC/mtriple.ll @@ -1478,19 +2482,20 @@ rm llvm/test/tools/gold/PowerPC/mtriple.ll # TODO(kkleine): Add this to XFAIL instead? rm llvm/test/tools/dsymutil/X86/swift-interface.test -%if %{with check} - cd llvm +%if %{with check} + #region Helper functions # Call this function before setting up a next component to test. function reset_test_opts() { - # Some libraries will not be found if we don't set this - export LD_LIBRARY_PATH="%{buildroot}/%{install_libdir}:%{buildroot}/%{_libdir}"; - # See https://llvm.org/docs/CommandGuide/lit.html#general-options export LIT_OPTS="-vv --time-tests" + # --timeout needs psutil package, so disable it on RHEL 8. + %if %{undefined rhel} || 0%{?rhel} > 8 + export LIT_OPTS="$LIT_OPTS --timeout=600" + %endif # Set to mark tests as expected to fail. # See https://llvm.org/docs/CommandGuide/lit.html#cmdoption-lit-xfail @@ -1509,6 +2514,9 @@ function reset_test_opts() # Set for filtering out unit tests. # See http://google.github.io/googletest/advanced.html#running-a-subset-of-the-tests unset GTEST_FILTER + + # Some test (e.g. mlir) require this to be set. + unset PYTHONPATH } # Convert array of test names into a regex. @@ -1535,6 +2543,21 @@ function test_list_to_regex() # Add enclosing parenthesis echo "($arr)" } + +# Similar to test_list_to_regex() except that this function exports +# the LIT_FILTER_OUT if there are tests in the given list. +# If there are no tests, the LIT_FILTER_OUT is unset in order to +# avoid issues with the llvm test system. +function adjust_lit_filter_out() +{ + local -n arr=$1 + local res=$(test_list_to_regex test_list_filter_out) + if [[ "$res" != "()" ]]; then + export LIT_FILTER_OUT=$res + else + unset LIT_FILTER_OUT + fi +} #endregion Helper functions #region Test LLVM lit @@ -1553,6 +2576,7 @@ export LIT_XFAIL="tools/UpdateTestChecks" #region Test CLANG reset_test_opts export LIT_XFAIL="$LIT_XFAIL;clang/test/CodeGen/profile-filter.c" + %cmake_build --target check-clang #endregion Test Clang @@ -1603,12 +2627,14 @@ export LIT_XFAIL="$LIT_XFAIL;api_tests/test_ompd_get_curr_parallel_handle.c" export LIT_XFAIL="$LIT_XFAIL;api_tests/test_ompd_get_display_control_vars.c" export LIT_XFAIL="$LIT_XFAIL;api_tests/test_ompd_get_thread_handle.c" +%if %{with pgo} +# TODO(kkleine): I unset LIT_XFAIL here because the tests above unexpectedly passed since Aug 16th on fedora-40-x86_64 +unset LIT_XFAIL +%endif + # The following test is flaky and we'll filter it out -test_list_filter_out+=("libomp :: ompt/teams/distribute_dispatch.c") test_list_filter_out+=("libomp :: affinity/kmp-abs-hw-subset.c") -test_list_filter_out+=("libomp :: parallel/bug63197.c") -test_list_filter_out+=("libomp :: tasking/issue-69733.c") -test_list_filter_out+=("libarcher :: races/task-taskgroup-unrelated.c") +test_list_filter_out+=("libomp :: ompt/teams/distribute_dispatch.c") # These tests fail more often than not, but not always. test_list_filter_out+=("libomp :: worksharing/for/omp_collapse_many_GELTGT_int.c") @@ -1618,13 +2644,7 @@ test_list_filter_out+=("libomp :: worksharing/for/omp_collapse_one_int.c") %ifarch s390x test_list_filter_out+=("libomp :: flush/omp_flush.c") -%endif - -%ifarch aarch64 s390x -# The following test has been failling intermittently on aarch64 and s390x. -# Re-enable it after https://github.com/llvm/llvm-project/issues/117773 -# gets fixed. -test_list_filter_out+=("libarcher :: races/taskwait-depend.c") +test_list_filter_out+=("libomp :: worksharing/for/omp_for_schedule_guided.c") %endif # The following tests seem pass on ppc64le and x86_64 and aarch64 only: @@ -1667,9 +2687,9 @@ export LIT_XFAIL="$LIT_XFAIL;races/lock-unrelated.c" export LIT_XFAIL="$LIT_XFAIL;races/parallel-simple.c" export LIT_XFAIL="$LIT_XFAIL;races/task-dependency.c" export LIT_XFAIL="$LIT_XFAIL;races/task-taskgroup-unrelated.c" -export LIT_XFAIL="$LIT_XFAIL;races/task-taskwait-nested.c" export LIT_XFAIL="$LIT_XFAIL;races/task-two.c" export LIT_XFAIL="$LIT_XFAIL;races/taskwait-depend.c" +export LIT_XFAIL="$LIT_XFAIL;races/task-taskwait-nested.c" export LIT_XFAIL="$LIT_XFAIL;reduction/parallel-reduction-nowait.c" export LIT_XFAIL="$LIT_XFAIL;reduction/parallel-reduction.c" export LIT_XFAIL="$LIT_XFAIL;task/omp_task_depend_all.c" @@ -1726,10 +2746,41 @@ export LIT_XFAIL="$LIT_XFAIL;offloading/thread_state_1.c" export LIT_XFAIL="$LIT_XFAIL;offloading/thread_state_2.c" %endif -export LIT_FILTER_OUT=$(test_list_to_regex test_list_filter_out) +adjust_lit_filter_out test_list_filter_out -# Disable openmp tests on s390x due to long-running tests. -%ifnarch s390x +# This allows openmp tests to be re-run 4 times. Once they pass +# after being re-run, they are marked as FLAKYPASS. +# See https://github.com/llvm/llvm-project/pull/141851 for the +# --max-retries-per-test option. +# We don't know if 4 is the right number to use here we just +# need to start with some number. +# Once https://github.com/llvm/llvm-project/pull/142413 landed +# we can see the exact number of attempts the tests needed +# to pass. And then we can adapt this number. +export LIT_OPTS="$LIT_OPTS --max-retries-per-test=4" + +%if %{with flang} +# Without this we run into a libflang_rt.runtime.so not found error. +# See https://github.com/llvm/llvm-project/pull/150722 for why this only +# happens when flang is found. +export LD_LIBRARY_PATH=%{buildroot}%{_prefix}/lib/clang/%{maj_ver}/lib/%{llvm_triple} +%endif + +%if 0%{?rhel} +# libomp tests are often very slow on s390x brew builders +%ifnarch s390x riscv64 +# Rarely, the system clang uses a GCC installation directory that is +# different from what we'd like to build with. +# Our newly built clang ends up using that old GCC because of the config +# files under /etc/clang pointing to the old GCC. We won't be able to run all +# tests because the installed libatomic cannot be found due to our newly built +# clang using the wrong GCC directory, e.g. we installed the libatomic from +# the latest GTS, but the installed GCC is 1 version earlier. +if is_gts_equal; then + %cmake_build --target check-openmp +fi +%endif +%else %cmake_build --target check-openmp %endif #endregion Test OPENMP @@ -1755,17 +2806,118 @@ export LIT_FILTER_OUT=$(test_list_to_regex test_list_filter_out) %endif %endif +#region test libcxx +# TODO(kkleine): Fedora rawhide didn't contain check runs. Evaluate if we want them here. +#endregion test libcxx + #region Test LLD reset_test_opts %cmake_build --target check-lld #endregion Test LLD +#region Test MLIR +%if %{with mlir} +reset_test_opts + +%ifarch s390x +# s390x does not support half-float +test_list_filter_out+=("MLIR :: python/ir/array_attributes.py") +test_list_filter_out+=("MLIR :: python/execution_engine.py") +%endif + +%ifarch ppc64le +# Medium code model can result in relocation failures, see: +# https://github.com/llvm/llvm-project/issues/129499 + +# Additionally, support for converting to/from fp16 was added on +# Power9 processors (aka. Power ISA 3.0). Even if the above issue +# is fixed, avoid running execution_engine.py on servers that do +# not support this ISA level, using the following condition: +# if ! LD_SHOW_AUXV=1 /bin/true | grep -q arch_3_00; then +test_list_filter_out+=("MLIR :: python/execution_engine.py") +test_list_filter_out+=("MLIR :: python/multithreaded_tests.py") +%endif + +%if %{with flang} +# TODO(kkleine): This test needs to be re-enabled. I currently only fails when building with flang. +# Here's the test failure: https://gist.github.com/kwk/5d551e27a28dfc1b34a09dca781f91df +test_list_filter_out+=("MLIR :: mlir-pdll-lsp-server/view-output.test") +%endif + +adjust_lit_filter_out test_list_filter_out + +export PYTHONPATH=%{buildroot}/%{python3_sitearch} +%cmake_build --target check-mlir +%endif +#endregion Test MLIR + +#region BOLT tests +%if %{with build_bolt} +reset_test_opts + +# Beginning with LLVM 20 this test has the "non-root-user" requirement +# and then the test should pass. But now it is flaky, hence we can only +# filter it out. +test_list_filter_out+=("BOLT :: unreadable-profile.test") + +%ifarch aarch64 +# Failing test cases on aarch64 +# TODO(kkleine): The following used to fail on aarch64 but passed today. +#export LIT_XFAIL="$LIT_XFAIL;cache+-deprecated.test" +#export LIT_XFAIL="$LIT_XFAIL;bolt-icf.test" +#export LIT_XFAIL="$LIT_XFAIL;R_ABS.pic.lld.cpp" + +# The following tests require LSE in order to run. +# More info at: https://github.com/llvm/llvm-project/issues/86485 +if ! grep -q atomics /proc/cpuinfo; then + test_list_filter_out+=("BOLT :: runtime/AArch64/basic-instrumentation.test") + test_list_filter_out+=("BOLT :: runtime/AArch64/hook-fini.test") + test_list_filter_out+=("BOLT :: runtime/AArch64/instrumentation-ind-call.c") + test_list_filter_out+=("BOLT :: runtime/exceptions-instrumentation.test") + test_list_filter_out+=("BOLT :: runtime/instrumentation-indirect-2.c") + test_list_filter_out+=("BOLT :: runtime/pie-exceptions-split.test") +fi +%endif + +adjust_lit_filter_out test_list_filter_out + +%cmake_build --target check-bolt +%endif +#endregion BOLT tests + +#region polly tests +%if %{with polly} +reset_test_opts +%cmake_build --target check-polly +%endif +#endregion polly tests + +#region flang tests +%if %{with flang} +reset_test_opts + +# https://github.com/llvm/llvm-project/issues/126051 +test_list_filter_out+=("Flang :: Driver/linker-flags.f90") + +# We filter our the location.f90 test for now because with LTO+PGO enabled, +# We miss the location.f90 entry in the loc_kind_array[ base, inclusion] entry. +# https://github.com/llvm/llvm-project/issues/156629 +test_list_filter_out+=("Flang :: Lower/location.f90") + +adjust_lit_filter_out test_list_filter_out + +%cmake_build --target check-flang +%cmake_build --target check-flang-rt + +%endif +#endregion flang tests + %endif %if %{with snapshot_build} # Do this here instead of in install so the check targets are also included. -cp %{_vpath_builddir}/.ninja_log %{buildroot}%{pkg_datadir} +cp %{_vpath_builddir}/.ninja_log %{buildroot}%{_datadir} %endif #endregion check @@ -1778,9 +2930,15 @@ cp %{_vpath_builddir}/.ninja_log %{buildroot}%{pkg_datadir} %endif %post -n %{pkg_name_llvm}-devel -%{_sbindir}/update-alternatives --install %{_bindir}/llvm-config%{exec_suffix} llvm-config%{exec_suffix} %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} %{__isa_bits} +update-alternatives --install %{_bindir}/llvm-config-%{maj_ver} llvm-config-%{maj_ver} %{install_bindir}/llvm-config %{__isa_bits} %if %{without compat_build} -%{_sbindir}/update-alternatives --install %{_bindir}/llvm-config-%{maj_ver} llvm-config-%{maj_ver} %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} %{__isa_bits} +# Prioritize newer LLVM versions over older and 64-bit over 32-bit. +update-alternatives --install %{_bindir}/llvm-config llvm-config %{install_bindir}/llvm-config $((%{maj_ver}*100+%{__isa_bits})) + +# Remove old llvm-config-%{__isa_bits} alternative. This will only do something during the +# first upgrade from a version that used it. In all other cases it will error, so suppress the +# expected error message. +update-alternatives --remove llvm-config %{_bindir}/llvm-config-%{__isa_bits} 2>/dev/null ||: # During the upgrade from LLVM 16 (F38) to LLVM 17 (F39), we found out the # main llvm-devel package was leaving entries in the alternatives system. @@ -1788,39 +2946,79 @@ cp %{_vpath_builddir}/.ninja_log %{buildroot}%{pkg_datadir} for v in 14 15 16; do if [[ -e %{_bindir}/llvm-config-$v && "x$(%{_bindir}/llvm-config-$v --version | awk -F . '{ print $1 }')" != "x$v" ]]; then - %{_sbindir}/update-alternatives --remove llvm-config-$v %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} + update-alternatives --remove llvm-config-$v %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} fi done %endif %postun -n %{pkg_name_llvm}-devel if [ $1 -eq 0 ]; then - %{_sbindir}/update-alternatives --remove llvm-config%{exec_suffix} %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} + update-alternatives --remove llvm-config%{exec_suffix} %{install_bindir}/llvm-config fi %if %{without compat_build} -# When upgrading between minor versions (i.e. from x.y.1 to x.y.2), we must -# not remove the alternative. -# However, during a major version upgrade (i.e. from 16.x.y to 17.z.w), the -# alternative must be removed in order to give priority to a newly installed -# compat package. -if [[ $1 -eq 0 - || "x$(%{_bindir}/llvm-config%{exec_suffix} --version | awk -F . '{ print $1 }')" != "x%{maj_ver}" ]]; then - %{_sbindir}/update-alternatives --remove llvm-config-%{maj_ver} %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} +# There are a number of different cases here: +# Uninstall: Remove alternatives. +# Patch version upgrade: Keep alternatives. +# Major version upgrade with installation of compat package: Keep alternatives for compat package. +# Major version upgrade without installation of compat package: Remove alternatives. However, we +# can't distinguish it from the previous case, so we conservatively leave it behind. +if [ $1 -eq 0 ]; then + update-alternatives --remove llvm-config-%{maj_ver} %{install_bindir}/llvm-config fi %endif %if %{without compat_build} %post -n %{pkg_name_lld} -%{_sbindir}/update-alternatives --install %{_bindir}/ld ld %{_bindir}/ld.lld 1 +update-alternatives --install %{_bindir}/ld ld %{_bindir}/ld.lld 1 %postun -n %{pkg_name_lld} if [ $1 -eq 0 ] ; then - %{_sbindir}/update-alternatives --remove ld %{_bindir}/ld.lld + update-alternatives --remove ld %{_bindir}/ld.lld fi %endif #endregion misc #region files +%define expand_bins() %{lua: + local bindir = rpm.expand("%{_bindir}") + local install_bindir = rpm.expand("%{install_bindir}") + local maj_ver = rpm.expand("%{maj_ver}") + for arg in rpm.expand("%*"):gmatch("%S+") do + print(install_bindir .. "/" .. arg .. "\\n") + print(bindir .. "/" .. arg .. "-" .. maj_ver .. "\\n") + if rpm.expand("%{without compat_build}") == "1" then + print(bindir .. "/" .. arg .. "\\n") + end + end +} + +%define expand_mans() %{lua: + local mandir = rpm.expand("%{_mandir}") + local maj_ver = rpm.expand("%{maj_ver}") + for arg in rpm.expand("%*"):gmatch("%S+") do + print(mandir .. "/man1/" .. arg .. "-" .. maj_ver .. ".1.gz\\n") + if rpm.expand("%{without compat_build}") == "1" then + print(mandir .. "/man1/" .. arg .. ".1.gz\\n") + end + end +} + +%define expand_generic(d:i:) %{lua: + local dir = rpm.expand("%{-d*}") + local install_dir = rpm.expand("%{-i*}") + for arg in rpm.expand("%*"):gmatch("%S+") do + print(install_dir .. "/" .. arg .. "\\n") + if rpm.expand("%{without compat_build}") == "1" then + print(dir .. "/" .. arg .. "\\n") + end + end +} + +%define expand_libs() %{expand_generic -d %{_libdir} -i %{install_libdir} %*} +%define expand_libexecs() %{expand_generic -d %{_libexecdir} -i %{install_libexecdir} %*} +%define expand_includes() %{expand_generic -d %{_includedir} -i %{install_includedir} %*} +%define expand_datas() %{expand_generic -d %{_datadir} -i %{install_datadir} %*} + #region LLVM lit files %if %{with python_lit} %files -n python%{python3_pkgversion}-lit @@ -1834,276 +3032,199 @@ fi #region LLVM files +%files -n %{pkg_name_llvm}-filesystem +%dir %{install_prefix} +%dir %{install_bindir} +%dir %{install_includedir} +%dir %{install_libdir} +%dir %{install_libdir}/cmake +%dir %{install_libexecdir} +%dir %{install_datadir} + %files -n %{pkg_name_llvm} %license llvm/LICENSE.TXT -%exclude %{_mandir}/man1/llvm-config* -%{_mandir}/man1/bugpoint%{exec_suffix}.1.gz -%{_mandir}/man1/clang-tblgen%{exec_suffix}.1.gz -%{_mandir}/man1/dsymutil%{exec_suffix}.1.gz -%{_mandir}/man1/FileCheck%{exec_suffix}.1.gz -%{_mandir}/man1/lit%{exec_suffix}.1.gz -%{_mandir}/man1/llc%{exec_suffix}.1.gz -%{_mandir}/man1/lldb-tblgen%{exec_suffix}.1.gz -%{_mandir}/man1/lli%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-addr2line%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-ar%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-as%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-bcanalyzer%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-cov%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-cxxfilt%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-cxxmap%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-debuginfo-analyzer%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-diff%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-dis%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-dwarfdump%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-dwarfutil%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-exegesis%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-extract%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-ifs%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-install-name-tool%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-lib%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-libtool-darwin%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-link%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-lipo%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-locstats%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-mc%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-mca%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-nm%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-objcopy%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-objdump%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-opt-report%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-otool%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-pdbutil%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-profdata%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-profgen%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-ranlib%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-readelf%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-readobj%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-reduce%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-remarkutil%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-size%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-stress%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-strings%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-strip%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-symbolizer%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-tblgen%{exec_suffix}.1.gz -%{_mandir}/man1/llvm-tli-checker%{exec_suffix}.1.gz -%{_mandir}/man1/mlir-tblgen%{exec_suffix}.1.gz -%{_mandir}/man1/opt%{exec_suffix}.1.gz -%{_mandir}/man1/tblgen%{exec_suffix}.1.gz -%if %{maj_ver} >= 20 -%{_mandir}/man1/llvm-cgdata%{exec_suffix}.1.gz +%{expand_bins %{expand: + bugpoint + dsymutil + FileCheck + llc + lli + llvm-addr2line + llvm-ar + llvm-as + llvm-bcanalyzer + llvm-bitcode-strip + llvm-c-test + llvm-cat + llvm-cfi-verify + llvm-cgdata + llvm-cov + llvm-ctxprof-util + llvm-cvtres + llvm-cxxdump + llvm-cxxfilt + llvm-cxxmap + llvm-debuginfo-analyzer + llvm-debuginfod + llvm-debuginfod-find + llvm-diff + llvm-dis + llvm-dlltool + llvm-dwarfdump + llvm-dwarfutil + llvm-dwp + llvm-exegesis + llvm-extract + llvm-gsymutil + llvm-ifs + llvm-install-name-tool + llvm-jitlink + llvm-jitlink-executor + llvm-lib + llvm-libtool-darwin + llvm-link + llvm-lipo + llvm-lto + llvm-lto2 + llvm-mc + llvm-mca + llvm-ml + llvm-ml64 + llvm-modextract + llvm-mt + llvm-nm + llvm-objcopy + llvm-objdump + llvm-opt-report + llvm-otool + llvm-pdbutil + llvm-PerfectShuffle + llvm-profdata + llvm-profgen + llvm-ranlib + llvm-rc + llvm-readelf + llvm-readobj + llvm-readtapi + llvm-reduce + llvm-remarkutil + llvm-rtdyld + llvm-sim + llvm-size + llvm-split + llvm-stress + llvm-strings + llvm-strip + llvm-symbolizer + llvm-tblgen + llvm-tli-checker + llvm-undname + llvm-windres + llvm-xray + reduce-chunk-list + obj2yaml + opt + sancov + sanstats + split-file + UnicodeNameMappingGenerator + verify-uselistorder + yaml2obj +}} + +%if %{maj_ver} >= 22 +%{expand_bins %{expand: + llvm-ir2vec + llvm-offload-wrapper + llvm-offload-binary +}} %endif -%{install_bindir}/bugpoint -%{install_bindir}/dsymutil -%{install_bindir}/FileCheck -%{install_bindir}/llc -%{install_bindir}/lli -%{install_bindir}/llvm-addr2line -%{install_bindir}/llvm-ar -%{install_bindir}/llvm-as -%{install_bindir}/llvm-bcanalyzer -%{install_bindir}/llvm-bitcode-strip -%{install_bindir}/llvm-c-test -%{install_bindir}/llvm-cat -%{install_bindir}/llvm-cfi-verify -%{install_bindir}/llvm-cov -%{install_bindir}/llvm-cvtres -%{install_bindir}/llvm-cxxdump -%{install_bindir}/llvm-cxxfilt -%{install_bindir}/llvm-cxxmap -%{install_bindir}/llvm-debuginfo-analyzer -%{install_bindir}/llvm-debuginfod -%{install_bindir}/llvm-debuginfod-find -%{install_bindir}/llvm-diff -%{install_bindir}/llvm-dis -%{install_bindir}/llvm-dlltool -%{install_bindir}/llvm-dwarfdump -%{install_bindir}/llvm-dwarfutil -%{install_bindir}/llvm-dwp -%{install_bindir}/llvm-exegesis -%{install_bindir}/llvm-extract -%{install_bindir}/llvm-gsymutil -%{install_bindir}/llvm-ifs -%{install_bindir}/llvm-install-name-tool -%{install_bindir}/llvm-jitlink -%{install_bindir}/llvm-jitlink-executor -%{install_bindir}/llvm-lib -%{install_bindir}/llvm-libtool-darwin -%{install_bindir}/llvm-link -%{install_bindir}/llvm-lipo -%{install_bindir}/llvm-lto -%{install_bindir}/llvm-lto2 -%{install_bindir}/llvm-mc -%{install_bindir}/llvm-mca -%{install_bindir}/llvm-ml -%{install_bindir}/llvm-modextract -%{install_bindir}/llvm-mt -%{install_bindir}/llvm-nm -%{install_bindir}/llvm-objcopy -%{install_bindir}/llvm-objdump -%{install_bindir}/llvm-opt-report -%{install_bindir}/llvm-otool -%{install_bindir}/llvm-pdbutil -%{install_bindir}/llvm-PerfectShuffle -%{install_bindir}/llvm-profdata -%{install_bindir}/llvm-profgen -%{install_bindir}/llvm-ranlib -%{install_bindir}/llvm-rc -%{install_bindir}/llvm-readelf -%{install_bindir}/llvm-readobj -%{install_bindir}/llvm-readtapi -%{install_bindir}/llvm-reduce -%{install_bindir}/llvm-remarkutil -%{install_bindir}/llvm-rtdyld -%{install_bindir}/llvm-sim -%{install_bindir}/llvm-size -%{install_bindir}/llvm-split -%{install_bindir}/llvm-stress -%{install_bindir}/llvm-strings -%{install_bindir}/llvm-strip -%{install_bindir}/llvm-symbolizer -%{install_bindir}/llvm-tblgen -%{install_bindir}/llvm-tli-checker -%{install_bindir}/llvm-undname -%{install_bindir}/llvm-windres -%{install_bindir}/llvm-xray -%{install_bindir}/reduce-chunk-list -%{install_bindir}/obj2yaml -%{install_bindir}/opt -%{install_bindir}/sancov -%{install_bindir}/sanstats -%{install_bindir}/split-file -%{install_bindir}/UnicodeNameMappingGenerator -%{install_bindir}/verify-uselistorder -%{install_bindir}/yaml2obj -%if %{maj_ver} >= 20 -%{install_bindir}/llvm-cgdata -%{install_bindir}/llvm-ctxprof-util +%{expand_mans %{expand: + bugpoint + clang-tblgen + dsymutil + FileCheck + lit + llc + lldb-tblgen + lli + llvm-addr2line + llvm-ar + llvm-as + llvm-bcanalyzer + llvm-cgdata + llvm-cov + llvm-cxxfilt + llvm-cxxmap + llvm-debuginfo-analyzer + llvm-diff + llvm-dis + llvm-dwarfdump + llvm-dwarfutil + llvm-exegesis + llvm-extract + llvm-ifs + llvm-install-name-tool + llvm-lib + llvm-libtool-darwin + llvm-link + llvm-lipo + llvm-locstats + llvm-mc + llvm-mca + llvm-nm + llvm-objcopy + llvm-objdump + llvm-opt-report + llvm-otool + llvm-pdbutil + llvm-profdata + llvm-profgen + llvm-ranlib + llvm-readelf + llvm-readobj + llvm-reduce + llvm-remarkutil + llvm-size + llvm-stress + llvm-strings + llvm-strip + llvm-symbolizer + llvm-tblgen + llvm-tli-checker + mlir-tblgen + opt + tblgen +}} + +%if %{maj_ver} >= 22 +%{expand_mans %{expand: + llvm-ir2vec + llvm-offload-binary +}} %endif - -%if %{with compat_build} -# This is for all the binaries with the version suffix. -%{_bindir}/bugpoint%{exec_suffix} -%{_bindir}/dsymutil%{exec_suffix} -%{_bindir}/FileCheck%{exec_suffix} -%{_bindir}/llc%{exec_suffix} -%{_bindir}/lli%{exec_suffix} -%{_bindir}/llvm-addr2line%{exec_suffix} -%{_bindir}/llvm-ar%{exec_suffix} -%{_bindir}/llvm-as%{exec_suffix} -%{_bindir}/llvm-bcanalyzer%{exec_suffix} -%{_bindir}/llvm-bitcode-strip%{exec_suffix} -%{_bindir}/llvm-c-test%{exec_suffix} -%{_bindir}/llvm-cat%{exec_suffix} -%{_bindir}/llvm-cfi-verify%{exec_suffix} -%{_bindir}/llvm-cov%{exec_suffix} -%{_bindir}/llvm-cvtres%{exec_suffix} -%{_bindir}/llvm-cxxdump%{exec_suffix} -%{_bindir}/llvm-cxxfilt%{exec_suffix} -%{_bindir}/llvm-cxxmap%{exec_suffix} -%{_bindir}/llvm-debuginfo-analyzer%{exec_suffix} -%{_bindir}/llvm-debuginfod%{exec_suffix} -%{_bindir}/llvm-debuginfod-find%{exec_suffix} -%{_bindir}/llvm-diff%{exec_suffix} -%{_bindir}/llvm-dis%{exec_suffix} -%{_bindir}/llvm-dlltool%{exec_suffix} -%{_bindir}/llvm-dwarfdump%{exec_suffix} -%{_bindir}/llvm-dwarfutil%{exec_suffix} -%{_bindir}/llvm-dwp%{exec_suffix} -%{_bindir}/llvm-exegesis%{exec_suffix} -%{_bindir}/llvm-extract%{exec_suffix} -%{_bindir}/llvm-gsymutil%{exec_suffix} -%{_bindir}/llvm-ifs%{exec_suffix} -%{_bindir}/llvm-install-name-tool%{exec_suffix} -%{_bindir}/llvm-jitlink%{exec_suffix} -%{_bindir}/llvm-jitlink-executor%{exec_suffix} -%{_bindir}/llvm-lib%{exec_suffix} -%{_bindir}/llvm-libtool-darwin%{exec_suffix} -%{_bindir}/llvm-link%{exec_suffix} -%{_bindir}/llvm-lipo%{exec_suffix} -%{_bindir}/llvm-lto%{exec_suffix} -%{_bindir}/llvm-lto2%{exec_suffix} -%{_bindir}/llvm-mc%{exec_suffix} -%{_bindir}/llvm-mca%{exec_suffix} -%{_bindir}/llvm-ml%{exec_suffix} -%{_bindir}/llvm-modextract%{exec_suffix} -%{_bindir}/llvm-mt%{exec_suffix} -%{_bindir}/llvm-nm%{exec_suffix} -%{_bindir}/llvm-objcopy%{exec_suffix} -%{_bindir}/llvm-objdump%{exec_suffix} -%{_bindir}/llvm-opt-report%{exec_suffix} -%{_bindir}/llvm-otool%{exec_suffix} -%{_bindir}/llvm-pdbutil%{exec_suffix} -%{_bindir}/llvm-PerfectShuffle%{exec_suffix} -%{_bindir}/llvm-profdata%{exec_suffix} -%{_bindir}/llvm-profgen%{exec_suffix} -%{_bindir}/llvm-ranlib%{exec_suffix} -%{_bindir}/llvm-rc%{exec_suffix} -%{_bindir}/llvm-readelf%{exec_suffix} -%{_bindir}/llvm-readobj%{exec_suffix} -%{_bindir}/llvm-readtapi%{exec_suffix} -%{_bindir}/llvm-reduce%{exec_suffix} -%{_bindir}/llvm-remarkutil%{exec_suffix} -%{_bindir}/llvm-rtdyld%{exec_suffix} -%{_bindir}/llvm-sim%{exec_suffix} -%{_bindir}/llvm-size%{exec_suffix} -%{_bindir}/llvm-split%{exec_suffix} -%{_bindir}/llvm-stress%{exec_suffix} -%{_bindir}/llvm-strings%{exec_suffix} -%{_bindir}/llvm-strip%{exec_suffix} -%{_bindir}/llvm-symbolizer%{exec_suffix} -%{_bindir}/llvm-tblgen%{exec_suffix} -%{_bindir}/llvm-tli-checker%{exec_suffix} -%{_bindir}/llvm-undname%{exec_suffix} -%{_bindir}/llvm-windres%{exec_suffix} -%{_bindir}/llvm-xray%{exec_suffix} -%{_bindir}/reduce-chunk-list%{exec_suffix} -%{_bindir}/obj2yaml%{exec_suffix} -%{_bindir}/opt%{exec_suffix} -%{_bindir}/sancov%{exec_suffix} -%{_bindir}/sanstats%{exec_suffix} -%{_bindir}/split-file%{exec_suffix} -%{_bindir}/UnicodeNameMappingGenerator%{exec_suffix} -%{_bindir}/verify-uselistorder%{exec_suffix} -%{_bindir}/yaml2obj%{exec_suffix} -%if %{maj_ver} >= 20 -%{_bindir}/llvm-cgdata%{exec_suffix} -%{_bindir}/llvm-ctxprof-util%{exec_suffix} -%endif - -%endif - -%exclude %{_bindir}/llvm-config%{exec_suffix} -%exclude %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} - -%exclude %{_bindir}/llvm-config-%{maj_ver} -%exclude %{install_bindir}/llvm-config-%{maj_ver}-%{__isa_bits} -%exclude %{install_bindir}/not -%exclude %{install_bindir}/count -%exclude %{install_bindir}/yaml-bench -%exclude %{install_bindir}/lli-child-target -%exclude %{install_bindir}/llvm-isel-fuzzer -%exclude %{install_bindir}/llvm-opt-fuzzer -%{pkg_datadir}/opt-viewer +%expand_datas opt-viewer %files -n %{pkg_name_llvm}-libs %license llvm/LICENSE.TXT -%{install_libdir}/libLLVM-%{maj_ver}%{?llvm_snapshot_version_suffix}.so +%{expand_libs %{expand: + libLLVM-%{maj_ver}%{?llvm_snapshot_version_suffix}.so + libLLVM.so.%{maj_ver}.%{min_ver}%{?llvm_snapshot_version_suffix} + libLTO.so* + libRemarks.so* +}} %if %{with gold} -%{install_libdir}/LLVMgold.so +%expand_libs LLVMgold.so %if %{without compat_build} %{_libdir}/bfd-plugins/LLVMgold.so %endif %endif -%{install_libdir}/libLLVM.so.%{maj_ver}.%{min_ver}%{?llvm_snapshot_version_suffix} -%{install_libdir}/libLTO.so* -%{install_libdir}/libRemarks.so* + %if %{with compat_build} -%config(noreplace) /etc/ld.so.conf.d/%{name}-%{_arch}.conf +%config(noreplace) %{_sysconfdir}/ld.so.conf.d/%{pkg_name_llvm}-%{_arch}.conf %endif %if %{with bundle_compat_lib} %{_libdir}/libLLVM.so.%{compat_maj_ver}* @@ -2112,20 +3233,18 @@ fi %files -n %{pkg_name_llvm}-devel %license llvm/LICENSE.TXT +%{install_bindir}/llvm-config +%ghost %{_bindir}/llvm-config-%{maj_ver} %if %{without compat_build} %ghost %{_bindir}/llvm-config -%{install_bindir}/llvm-config-%{__isa_bits} -%else -%{install_bindir}/llvm-config %endif -%ghost %{_bindir}/llvm-config-%{maj_ver} -%{install_bindir}/llvm-config-%{maj_ver}-%{__isa_bits} -%{_mandir}/man1/llvm-config* -%{install_includedir}/llvm -%{install_includedir}/llvm-c -%{install_libdir}/libLLVM.so -%{install_libdir}/cmake/llvm +%expand_mans llvm-config +%expand_includes llvm llvm-c +%{expand_libs %{expand: + libLLVM.so + cmake/llvm +}} %files -n %{pkg_name_llvm}-doc %license llvm/LICENSE.TXT @@ -2133,43 +3252,51 @@ fi %files -n %{pkg_name_llvm}-static %license llvm/LICENSE.TXT -%{install_libdir}/libLLVM*.a +%expand_libs libLLVM*.a %exclude %{install_libdir}/libLLVMTestingSupport.a %exclude %{install_libdir}/libLLVMTestingAnnotations.a +%if %{without compat_build} +%exclude %{_libdir}/libLLVMTestingSupport.a +%exclude %{_libdir}/libLLVMTestingAnnotations.a +%endif %files -n %{pkg_name_llvm}-cmake-utils %license llvm/LICENSE.TXT -%{pkg_datadir}/llvm/cmake +%expand_datas llvm-cmake %files -n %{pkg_name_llvm}-test %license llvm/LICENSE.TXT -%{install_bindir}/not -%{install_bindir}/count -%{install_bindir}/yaml-bench -%{install_bindir}/lli-child-target -%{install_bindir}/llvm-isel-fuzzer -%{install_bindir}/llvm-opt-fuzzer -%if %{with compat_build} -%{_bindir}/not%{exec_suffix} -%{_bindir}/count%{exec_suffix} -%{_bindir}/yaml-bench%{exec_suffix} -%{_bindir}/lli-child-target%{exec_suffix} -%{_bindir}/llvm-isel-fuzzer%{exec_suffix} -%{_bindir}/llvm-opt-fuzzer%{exec_suffix} +%{expand_bins %{expand: + not + count + yaml-bench + lli-child-target + llvm-isel-fuzzer + llvm-opt-fuzzer + llvm-test-mustache-spec +}} +%if %{maj_ver} >= 22 +%{expand_bins %{expand: + llvm-cas +}} %endif +%{expand_mans %{expand: + llvm-test-mustache-spec +}} %files -n %{pkg_name_llvm}-googletest %license llvm/LICENSE.TXT -%{install_libdir}/libLLVMTestingSupport.a -%{install_libdir}/libLLVMTestingAnnotations.a -%{install_libdir}/libllvm_gtest.a -%{install_libdir}/libllvm_gtest_main.a -%{install_includedir}/llvm-gtest -%{install_includedir}/llvm-gmock +%{expand_libs %{expand: + libLLVMTestingSupport.a + libLLVMTestingAnnotations.a + libllvm_gtest.a + libllvm_gtest_main.a +}} +%expand_includes llvm-gtest llvm-gmock %if %{with snapshot_build} %files -n %{pkg_name_llvm}-build-stats -%{pkg_datadir}/.ninja_log +%{_datadir}/.ninja_log %endif #endregion LLVM files @@ -2178,35 +3305,42 @@ fi %files -n %{pkg_name_clang} %license clang/LICENSE.TXT -%{install_bindir}/clang -%{install_bindir}/clang++ +%{expand_bins %{expand: + clang + clang++ + clang-cl + clang-cpp + clang-scan-deps +}} %{install_bindir}/clang-%{maj_ver} -%{install_bindir}/clang++-%{maj_ver} -%{install_bindir}/clang-cl -%{install_bindir}/clang-cpp + %{_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 -%{_mandir}/man1/clang-%{maj_ver}.1.gz -%{_mandir}/man1/clang++-%{maj_ver}.1.gz -%if %{without compat_build} -%{_mandir}/man1/clang.1.gz -%{_mandir}/man1/clang++.1.gz -%else -%{_bindir}/clang-%{maj_ver} -%{_bindir}/clang++-%{maj_ver} -%{_bindir}/clang-cl-%{maj_ver} -%{_bindir}/clang-cpp-%{maj_ver} +%{expand_mans clang clang++} + +%if 0%{with pgo} +%{expand_datas %{expand: llvm-pgo.profdata }} %endif + %files -n %{pkg_name_clang}-libs %license clang/LICENSE.TXT %{_prefix}/lib/clang/%{maj_ver}/include/* -%{install_libdir}/libclang.so.%{maj_ver}* -%{install_libdir}/libclang-cpp.so.%{maj_ver}* +# Part of compiler-rt: +%exclude %{_prefix}/lib/clang/%{maj_ver}/include/fuzzer +%exclude %{_prefix}/lib/clang/%{maj_ver}/include/orc +%exclude %{_prefix}/lib/clang/%{maj_ver}/include/profile +%exclude %{_prefix}/lib/clang/%{maj_ver}/include/sanitizer +%exclude %{_prefix}/lib/clang/%{maj_ver}/include/xray +# Part of libomp-devel: +%exclude %{_prefix}/lib/clang/%{maj_ver}/include/omp*.h + +%expand_libs libclang.so.%{maj_ver}* +%expand_libs libclang-cpp.so.%{maj_ver}* %if %{with bundle_compat_lib} %{_libdir}/libclang.so.%{compat_maj_ver}* %{_libdir}/libclang-cpp.so.%{compat_maj_ver}* @@ -2214,16 +3348,17 @@ fi %files -n %{pkg_name_clang}-devel %license clang/LICENSE.TXT -%{install_libdir}/libclang-cpp.so -%{install_libdir}/libclang.so -%{install_includedir}/clang/ -%{install_includedir}/clang-c/ -%{install_libdir}/cmake/clang -%{install_bindir}/clang-tblgen -%if %{with compat_build} -%{_bindir}/clang-tblgen-%{maj_ver} -%endif +%{expand_libs %{expand: + cmake/clang + libclang-cpp.so + libclang.so +}} +%expand_includes clang clang-c +%expand_bins clang-tblgen %dir %{install_datadir}/clang/ +%if %{without compat_build} +%dir %{_datadir}/clang +%endif %files -n %{pkg_name_clang}-resource-filesystem %license clang/LICENSE.TXT @@ -2237,141 +3372,85 @@ fi %files -n %{pkg_name_clang}-analyzer %license clang/LICENSE.TXT -%{install_bindir}/scan-view -%{install_bindir}/scan-build -%{install_bindir}/analyze-build -%{install_bindir}/intercept-build -%{install_bindir}/scan-build-py -%if %{with compat_build} -%{_bindir}/scan-view-%{maj_ver} -%{_bindir}/scan-build-%{maj_ver} -%{_bindir}/analyze-build-%{maj_ver} -%{_bindir}/intercept-build-%{maj_ver} -%{_bindir}/scan-build-py-%{maj_ver} -%endif -%{install_libexecdir}/ccc-analyzer -%{install_libexecdir}/c++-analyzer -%{install_libexecdir}/analyze-c++ -%{install_libexecdir}/analyze-cc -%{install_libexecdir}/intercept-c++ -%{install_libexecdir}/intercept-cc -%{install_datadir}/scan-view/ -%{install_datadir}/scan-build/ -%{_mandir}/man1/scan-build%{exec_suffix}.1.* +%{expand_bins %{expand: + scan-view + scan-build + analyze-build + intercept-build +}} +%{expand_libexecs %{expand: + ccc-analyzer + c++-analyzer + analyze-c++ + analyze-cc + intercept-c++ + intercept-cc +}} +%expand_datas scan-view scan-build +%expand_mans scan-build %if %{without compat_build} +%expand_bins scan-build-py %{python3_sitelib}/libear %{python3_sitelib}/libscanbuild %endif - %files -n %{pkg_name_clang}-tools-extra %license clang-tools-extra/LICENSE.TXT -%{install_bindir}/amdgpu-arch -%{install_bindir}/clang-apply-replacements -%{install_bindir}/clang-change-namespace -%{install_bindir}/clang-check -%{install_bindir}/clang-doc -%{install_bindir}/clang-extdef-mapping -%{install_bindir}/clang-format -%{install_bindir}/clang-include-cleaner -%{install_bindir}/clang-include-fixer -%{install_bindir}/clang-installapi -%{install_bindir}/clang-move -%{install_bindir}/clang-offload-bundler -%{install_bindir}/clang-offload-packager -%{install_bindir}/clang-linker-wrapper -%{install_bindir}/clang-nvlink-wrapper -%{install_bindir}/clang-query -%{install_bindir}/clang-refactor -%{install_bindir}/clang-reorder-fields -%{install_bindir}/clang-repl -%{install_bindir}/clang-scan-deps -%if %{maj_ver} >= 20 -%{install_bindir}/clang-sycl-linker -%endif -%{install_bindir}/clang-tidy -%{install_bindir}/clangd -%{install_bindir}/diagtool -%{install_bindir}/hmaptool -%{install_bindir}/nvptx-arch -%{install_bindir}/pp-trace -%{install_bindir}/c-index-test -%{install_bindir}/find-all-symbols -%{install_bindir}/modularize -%{install_bindir}/clang-format-diff -%{install_bindir}/run-clang-tidy -%if %{maj_ver} < 20 -%{install_bindir}/clang-pseudo -%{install_bindir}/clang-rename -%endif -%if %{with compat_build} -%{_bindir}/amdgpu-arch-%{maj_ver} -%{_bindir}/clang-apply-replacements-%{maj_ver} -%{_bindir}/clang-change-namespace-%{maj_ver} -%{_bindir}/clang-check-%{maj_ver} -%{_bindir}/clang-doc-%{maj_ver} -%{_bindir}/clang-extdef-mapping-%{maj_ver} -%{_bindir}/clang-format-%{maj_ver} -%{_bindir}/clang-include-cleaner-%{maj_ver} -%{_bindir}/clang-include-fixer-%{maj_ver} -%{_bindir}/clang-installapi-%{maj_ver} -%{_bindir}/clang-move-%{maj_ver} -%{_bindir}/clang-offload-bundler-%{maj_ver} -%{_bindir}/clang-offload-packager-%{maj_ver} -%{_bindir}/clang-linker-wrapper-%{maj_ver} -%{_bindir}/clang-nvlink-wrapper-%{maj_ver} -%{_bindir}/clang-query-%{maj_ver} -%{_bindir}/clang-refactor-%{maj_ver} -%{_bindir}/clang-reorder-fields-%{maj_ver} -%{_bindir}/clang-repl-%{maj_ver} -%{_bindir}/clang-scan-deps-%{maj_ver} -%if %{maj_ver} >= 20 -%{_bindir}/clang-sycl-linker-%{maj_ver} -%endif -%{_bindir}/clang-tidy-%{maj_ver} -%{_bindir}/clangd-%{maj_ver} -%{_bindir}/diagtool-%{maj_ver} -%{_bindir}/hmaptool-%{maj_ver} -%{_bindir}/nvptx-arch-%{maj_ver} -%{_bindir}/pp-trace-%{maj_ver} -%{_bindir}/c-index-test-%{maj_ver} -%{_bindir}/find-all-symbols-%{maj_ver} -%{_bindir}/modularize-%{maj_ver} -%{_bindir}/clang-format-diff-%{maj_ver} -%{_bindir}/run-clang-tidy-%{maj_ver} -%if %{maj_ver} < 20 -%{_bindir}/clang-pseudo-%{maj_ver} -%{_bindir}/clang-rename-%{maj_ver} -%endif -%else +%{expand_bins %{expand: + amdgpu-arch + clang-apply-replacements + clang-change-namespace + clang-check + clang-doc + clang-extdef-mapping + clang-format + clang-include-cleaner + clang-include-fixer + clang-installapi + clang-move + clang-offload-bundler + clang-offload-packager + clang-linker-wrapper + clang-nvlink-wrapper + clang-query + clang-refactor + clang-reorder-fields + clang-repl + clang-sycl-linker + clang-tidy + clangd + diagtool + hmaptool + nvptx-arch + pp-trace + c-index-test + find-all-symbols + modularize + clang-format-diff + run-clang-tidy + offload-arch +}} + +%if %{without compat_build} %{_emacs_sitestartdir}/clang-format.el -%if %{maj_ver} < 20 -%{_emacs_sitestartdir}/clang-rename.el -%endif %{_emacs_sitestartdir}/clang-include-fixer.el %endif -%{_mandir}/man1/diagtool%{exec_suffix}.1.gz -%{_mandir}/man1/extraclangtools%{exec_suffix}.1.gz -%{install_datadir}/clang/clang-format.py* -%{install_datadir}/clang/clang-format-diff.py* -%{install_datadir}/clang/clang-include-fixer.py* -%{install_datadir}/clang/clang-tidy-diff.py* -%{install_datadir}/clang/run-find-all-symbols.py* -%if %{maj_ver} < 20 -%{install_datadir}/clang/clang-rename.py* -%endif - +%expand_mans diagtool extraclangtools +%{expand_datas %{expand: + clang/clang-format.py* + clang/clang-format-diff.py* + clang/clang-include-fixer.py* + clang/clang-tidy-diff.py* + clang/run-find-all-symbols.py* +}} %files -n %{pkg_name_clang}-tools-extra-devel %license clang-tools-extra/LICENSE.TXT -%{install_includedir}/clang-tidy/ +%expand_includes clang-tidy %files -n git-clang-format%{pkg_suffix} %license clang/LICENSE.TXT -%{install_bindir}/git-clang-format -%if %{with compat_build} -%{_bindir}/git-clang-format-%{maj_ver} -%endif +%expand_bins git-clang-format %if %{without compat_build} %files -n python%{python3_pkgversion}-clang @@ -2398,15 +3477,17 @@ fi # Files that appear on all targets %{_prefix}/lib/clang/%{maj_ver}/lib/%{compiler_rt_triple}/libclang_rt.* - -%ifnarch s390x %{_prefix}/lib/clang/%{maj_ver}/lib/%{compiler_rt_triple}/clang_rt.crtbegin.o %{_prefix}/lib/clang/%{maj_ver}/lib/%{compiler_rt_triple}/clang_rt.crtend.o -%endif -%ifnarch %{ix86} s390x +%ifnarch %{ix86} s390x riscv64 %{_prefix}/lib/clang/%{maj_ver}/lib/%{compiler_rt_triple}/liborc_rt.a %endif +%ifarch s390x +%if %{maj_ver} >= 22 +%{_prefix}/lib/clang/%{maj_ver}/lib/%{compiler_rt_triple}/liborc_rt.a +%endif +%endif # Additional symlink if two triples are in use. %if "%{llvm_triple}" != "%{compiler_rt_triple}" @@ -2419,13 +3500,14 @@ fi %files -n %{pkg_name_libomp} %license openmp/LICENSE.TXT -%{install_libdir}/libomp.so -%{install_libdir}/libompd.so -%{install_libdir}/libarcher.so -%ifnarch %{ix86} -# libomptarget is not supported on 32-bit systems. -# s390x does not support the offloading plugins. -%{install_libdir}/libomptarget.so.%{so_suffix} +%{expand_libs %{expand: + libomp.so + libompd.so + libarcher.so +}} +%if %{with offload} +%expand_libs libomptarget.so.%{so_suffix} +%expand_libs libLLVMOffload.so.%{so_suffix} %endif %files -n %{pkg_name_libomp}-devel @@ -2435,16 +3517,22 @@ fi %{_prefix}/lib/clang/%{maj_ver}/include/omp-tools.h %{_prefix}/lib/clang/%{maj_ver}/include/ompt.h %{_prefix}/lib/clang/%{maj_ver}/include/ompt-multiplex.h -%{install_libdir}/cmake/openmp/ -%ifnarch %{ix86} -# libomptarget is not supported on 32-bit systems. -# s390x does not support the offloading plugins. -%{install_libdir}/libomptarget.devicertl.a -%{install_libdir}/libomptarget-amdgpu-*.bc -%{install_libdir}/libomptarget-nvptx-*.bc -%{install_libdir}/libomptarget.so -%endif +%expand_libs cmake/openmp +%if %{with offload} +%{expand_libs %{expand: + libomptarget.so + libLLVMOffload.so +}} +%{expand_libs %{expand: + amdgcn-amd-amdhsa/libompdevice.a + amdgcn-amd-amdhsa/libomptarget-amdgpu.bc + nvptx64-nvidia-cuda/libompdevice.a + nvptx64-nvidia-cuda/libomptarget-nvptx.bc +}} + +%expand_includes offload +%endif #endregion OPENMP files #region LLD files @@ -2452,40 +3540,38 @@ fi %files -n %{pkg_name_lld} %license lld/LICENSE.TXT %ghost %{_bindir}/ld -%{install_bindir}/lld -%{install_bindir}/lld-link -%{install_bindir}/ld.lld -%{install_bindir}/ld64.lld -%{install_bindir}/wasm-ld -%if %{without compat_build} -%{_mandir}/man1/ld.lld.1* -%else -%{_bindir}/lld%{exec_suffix} -%{_bindir}/lld-link%{exec_suffix} -%{_bindir}/ld.lld%{exec_suffix} -%{_bindir}/ld64.lld%{exec_suffix} -%{_bindir}/wasm-ld%{exec_suffix} -%endif +%{expand_bins %{expand: + lld + lld-link + ld.lld + ld64.lld + wasm-ld +}} +%expand_mans ld.lld %files -n %{pkg_name_lld}-devel %license lld/LICENSE.TXT -%{install_includedir}/lld -%{install_libdir}/liblldCOFF.so -%{install_libdir}/liblldCommon.so -%{install_libdir}/liblldELF.so -%{install_libdir}/liblldMachO.so -%{install_libdir}/liblldMinGW.so -%{install_libdir}/liblldWasm.so -%{install_libdir}/cmake/lld/ +%expand_includes lld +%{expand_libs %{expand: + liblldCOFF.so + liblldCommon.so + liblldELF.so + liblldMachO.so + liblldMinGW.so + liblldWasm.so + cmake/lld +}} %files -n %{pkg_name_lld}-libs %license lld/LICENSE.TXT -%{install_libdir}/liblldCOFF.so.* -%{install_libdir}/liblldCommon.so.* -%{install_libdir}/liblldELF.so.* -%{install_libdir}/liblldMachO.so.* -%{install_libdir}/liblldMinGW.so.* -%{install_libdir}/liblldWasm.so.* +%{expand_libs %{expand: + liblldCOFF.so.* + liblldCommon.so.* + liblldELF.so.* + liblldMachO.so.* + liblldMinGW.so.* + liblldWasm.so.* +}} #endregion LLD files @@ -2500,435 +3586,256 @@ fi %if %{with lldb} %files -n %{pkg_name_lldb} %license lldb/LICENSE.TXT -%{install_bindir}/lldb* +%{expand_bins %{expand: + lldb + lldb-argdumper + lldb-dap + lldb-instr + lldb-server +}} +%if %{maj_ver} >= 22 +%{expand_bins %{expand: + lldb-mcp +}} +%endif # Usually, *.so symlinks are kept in devel subpackages. However, the python # bindings depend on this symlink at runtime. -%{install_libdir}/liblldb*.so -%{install_libdir}/liblldb.so.* -%{install_libdir}/liblldbIntelFeatures.so.* -%{_mandir}/man1/lldb-server%{exec_suffix}.1.gz -%{_mandir}/man1/lldb%{exec_suffix}.1.gz +%{expand_libs %{expand: + liblldb*.so + liblldb.so.* + liblldbIntelFeatures.so.* +}} +%expand_mans lldb-server lldb %if %{with bundle_compat_lib} %{_libdir}/liblldb.so.%{compat_maj_ver}* %endif %files -n %{pkg_name_lldb}-devel -%{install_includedir}/lldb +%expand_includes lldb +%if %{maj_ver} >= 22 +%{expand_bins %{expand: + lldb-tblgen + yaml2macho-core +}} +%endif +%if %{without compat_build} %files -n python%{python3_pkgversion}-lldb %{python3_sitearch}/lldb %endif +%endif #endregion LLDB files + + +#region MLIR files +%if %{with mlir} +%files -n %{pkg_name_mlir} +%license LICENSE.TXT +%{expand_libs %{expand: + libmlir_arm_runner_utils.so.%{maj_ver}* + libmlir_arm_sme_abi_stubs.so.%{maj_ver}* + libmlir_async_runtime.so.%{maj_ver}* + libmlir_c_runner_utils.so.%{maj_ver}* + libmlir_float16_utils.so.%{maj_ver}* + libmlir_runner_utils.so.%{maj_ver}* + libMLIR*.so.%{maj_ver}* +}} + +%if %{maj_ver} >= 22 +%{expand_libs %{expand: + libmlir_apfloat_wrappers.so.%{maj_ver}* +}} +%endif + +%files -n %{pkg_name_mlir}-static +%expand_libs libMLIR*.a + +%files -n %{pkg_name_mlir}-devel +%{expand_bins %{expand: + mlir-linalg-ods-yaml-gen + mlir-lsp-server + mlir-opt + mlir-pdll + mlir-pdll-lsp-server + mlir-query + mlir-reduce + mlir-rewrite + mlir-runner + mlir-tblgen + mlir-translate + tblgen-lsp-server + tblgen-to-irdl +}} +%expand_includes mlir mlir-c +%{expand_libs %{expand: + cmake/mlir + libmlir_arm_runner_utils.so + libmlir_arm_sme_abi_stubs.so + libmlir_async_runtime.so + libmlir_c_runner_utils.so + libmlir_float16_utils.so + libmlir_runner_utils.so + libMLIR*.so +}} + +%if %{maj_ver} >= 22 +%{expand_libs %{expand: + libmlir_apfloat_wrappers.so +}} +%endif + +%files -n python%{python3_pkgversion}-%{pkg_name_mlir} +%{python3_sitearch}/mlir/ +%endif +#endregion MLIR files + +#region libcxx files + +#region flang files +%if %{with flang} +%files -n %{pkg_name_flang} +%license flang/LICENSE.TXT +%{expand_mans flang} +%{expand_bins %{expand: + tco + bbc + fir-opt + fir-lsp-server + flang + flang-new +}} +%{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 +}} +%{_sysconfdir}/%{pkg_name_clang}/%{_target_platform}-flang.cfg +%ifarch x86_64 +%{_sysconfdir}/%{pkg_name_clang}/i386-redhat-linux-gnu-flang.cfg +%endif + +%{_prefix}/lib/clang/%{maj_ver}/include/ISO_Fortran_binding.h + +%files -n %{pkg_name_flang}-runtime +%{_prefix}/lib/clang/%{maj_ver}/lib/%{llvm_triple}/libflang_rt.runtime.a +%{_prefix}/lib/clang/%{maj_ver}/lib/%{llvm_triple}/libflang_rt.runtime.so +%config(noreplace) %{_sysconfdir}/ld.so.conf.d/%{pkg_name_flang}-%{_arch}.conf + +%endif +#region flang files + +%if %{with libcxx} + +%files -n %{pkg_name_libcxx} +%license libcxx/LICENSE.TXT +%doc libcxx/CREDITS.TXT libcxx/TODO.TXT +%{_libdir}/libc++.so.* + +%files -n %{pkg_name_libcxx}-devel +%{_includedir}/c++/ +%exclude %{_includedir}/c++/v1/cxxabi.h +%exclude %{_includedir}/c++/v1/__cxxabi_config.h +%{_libdir}/libc++.so +%{_libdir}/libc++.modules.json +%{_datadir}/libc++/v1/* + +%files -n %{pkg_name_libcxx}-static +%license libcxx/LICENSE.TXT +%{_libdir}/libc++.a +%{_libdir}/libc++experimental.a + +%files -n %{pkg_name_libcxxabi} +%license libcxxabi/LICENSE.TXT +%doc libcxxabi/CREDITS.TXT +%{_libdir}/libc++abi.so.* + +%files -n %{pkg_name_libcxxabi}-devel +%{_includedir}/c++/v1/cxxabi.h +%{_includedir}/c++/v1/__cxxabi_config.h +%{_libdir}/libc++abi.so + +%files -n %{pkg_name_libcxxabi}-static +%{_libdir}/libc++abi.a + +%files -n %{pkg_name_llvm_libunwind} +%license libunwind/LICENSE.TXT +%{_libdir}/libunwind.so.1 +%{_libdir}/libunwind.so.1.0 + +%files -n %{pkg_name_llvm_libunwind}-devel +%{_includedir}/llvm-libunwind/__libunwind_config.h +%{_includedir}/llvm-libunwind/libunwind.h +%{_includedir}/llvm-libunwind/libunwind.modulemap +%{_includedir}/llvm-libunwind/mach-o/compact_unwind_encoding.h +%{_includedir}/llvm-libunwind/unwind.h +%{_includedir}/llvm-libunwind/unwind_arm_ehabi.h +%{_includedir}/llvm-libunwind/unwind_itanium.h +%dir %{_libdir}/llvm-unwind +%{_libdir}/llvm-unwind/libunwind.so + +%files -n %{pkg_name_llvm_libunwind}-static +%{_libdir}/libunwind.a +%endif +#endregion libcxx files + +#region BOLT files +%if %{with build_bolt} +%files -n %{pkg_name_bolt} +%license bolt/LICENSE.TXT +%{expand_bins %{expand: + llvm-bolt + llvm-boltdiff + llvm-bolt-binary-analysis + llvm-bolt-heatmap + merge-fdata + perf2bolt +}} + +%{expand_libs %{expand: + libbolt_rt_hugify.a + libbolt_rt_instr.a +}} +%endif +#endregion BOLT files + +#region polly files +%if %{with polly} +%files -n %{pkg_name_polly} +%license polly/LICENSE.TXT +%{expand_libs %{expand: + LLVMPolly.so + libPolly.so.* + libPollyISL.so +}} +%expand_mans polly + +%files -n %{pkg_name_polly}-devel +%expand_libs libPolly.so +%expand_includes polly +%expand_libs cmake/polly + +%endif +#endregion polly files + #endregion files -#region changelog %changelog -* Wed Jan 15 2025 Tom Stellard - 19.1.7-1 -- 19.1.7 Release -* Tue Jan 14 2025 Tom Stellard - 19.1.5-2 -- Remove compat package - -* Tue Dec 03 2024 Timm Bäder - 19.1.5-1 -- Update to 19.1.5 - -* Tue Nov 26 2024 Tom Stellard - 19.1.3-4 -- Add explicit version requires to libomp for llvm-libs - -* Sun Nov 24 2024 Tom Stellard - 19.1.3-3 -- Use gcc-toolset-14 as the default gcc installation - -* Fri Nov 22 2024 Tom Stellard - 19.1.3-2 -- Default to DWARF-4 - -* Sat Nov 16 2024 Tom Stellard - 19.1.3-1 -- 19.1.3 Release - -* Fri Oct 18 2024 Tom Stellard - 18.1.8-3 -- Remove stray fi from postun scriptlet - -* Fri Oct 18 2024 Tulio Magno Quites Machado Filho - 18.1.8-2 -- Workaround for GFX11.5 export priority - -* Fri Oct 18 2024 Tom Stellard - 18.1.8-1 -- 18.1.8 Release - -* Fri Oct 18 2024 Tom Stellard - 18.1.2-1 -- 18.1.2 Release - -* Wed Jul 17 2024 Tom Stellard - 17.0.6-3 -- Backport fix for RHEL-49522 - -* Fri Feb 02 2024 Nikita Popov - 17.0.6-2 -- Fix crash with -fzero-call-used-regs (RHEL-23865) - -* Wed Nov 29 2023 Nikita Popov - 17.0.6-1 -- Update to LLVM 17.0.6 - -* Mon Oct 23 2023 Nikita Popov - 17.0.2-2 -- Add Conflicts to llvm-googletest - -* Wed Oct 04 2023 Nikita Popov - 17.0.2-1 -- Update to LLVM 17.0.2 - -* Thu Aug 03 2023 Tulio Magno Quites Machado Filho - 16.0.6-3 -- Fix rhbz #2228944 - -* Wed Jul 19 2023 Tulio Magno Quites Machado Filho - 16.0.6-2 -- Improve error messages for unsupported relocs on s390x (rhbz#2216906) -- Disable LLVM_UNREACHABLE_OPTIMIZE - -* Sat Jun 17 2023 Tom Stellard - 16.0.6-1 -- 16.0.6 Release - -* Wed Apr 05 2023 Timm Bäder - 16.0.0-1 -- 16.0.0 Release - -* Thu Jan 19 2023 Tom Stellard - 15.0.7-1 -- 15.0.7 Release - -* Mon Oct 31 2022 Tom Stellard - 15.0.0-2 -- Re-enable debuginfo for ppc64le - -* Tue Sep 06 2022 Nikita Popov - 15.0.0-1 -- Update to LLVM 15.0.0 - -* Mon Jun 27 2022 Tom Stellard - 14.0.6-1 -- 14.0.6 Release - -* Mon May 23 2022 Timm Bäder - 14.0.0-3 -- Build gold plugin on s390x as well - -* Fri Apr 29 2022 Timm Bäder - 14.0.0-2 -- Remove llvm-cmake-devel package again - -* Thu Apr 07 2022 Timm Bäder - 14.0.0-1 -- Update to 14.0.0 - -* Wed Feb 02 2022 Tom Stellard - 13.0.1-1 -- 13.0.1 Release - -* Sat Jan 29 2022 Tom Stellard - 13.0.0-4 -- Rebuild with gcc fix from rhbz#2028609 - -* Thu Oct 21 2021 sguelton@redhat.com - 13.0.0-3 -- Correctly set ldflags - -* Wed Oct 20 2021 Tom Stellard - 13.0.0-2 -- Disable failing test on s390x - -* Thu Oct 14 2021 Tom Stellard - 13.0.0-1 -- 13.0.0 Release - -* Fri Jul 16 2021 sguelton@redhat.com - 12.0.1-1 -- 12.0.1 release - -* Fri Jul 02 2021 Tom Stellard - 12.0.0-2 -- Stop installing lit tests - -* Tue May 25 2021 sguelton@redhat.com - 12.0.0-1 -- Remove obsolete patch - -* Thu Oct 29 2020 sguelton@redhat.com - 11.0.0-2 -- Remove obsolete patch - -* Wed Sep 30 2020 sguelton@redhat.com - 11.0.0-1 -- 11.0.1 final release - -* Wed Sep 30 2020 sguelton@redhat.com - 11.0.0-0.6.rc2 -- Restore default CI behavior wrt. number of threads - -* Fri Sep 25 2020 sguelton@redhat.com - 11.0.0-0.5.rc2 -- Fix test case depending on fs capability - -* Fri Sep 25 2020 sguelton@redhat.com - 11.0.0-0.4.rc2 -- Fix dependency on dsymutil.rst from CI - -* Thu Sep 24 2020 sguelton@redhat.com - 11.0.0-0.3.rc2 -- Fix test file generation - -* Wed Sep 23 2020 sguelton@redhat.com - 11.0.0-0.2.rc2 -- Remove runtime dep on libedit-devel - -* Mon Sep 14 2020 sguelton@redhat.com - 11.0.0-0.1.rc2 -- 11.0.1.rc2 Release - -* Wed Aug 19 2020 Tom Stellard - 10.0.1-3 -- Fix rust crash on ppc64le compiling firefox - -* Fri Jul 31 2020 sguelton@redhat.com - 10.0.1-2 -- Fix llvm-config alternative handling, see rhbz#1859996 - -* Fri Jul 24 2020 sguelton@redhat.com - 10.0.1-1 -- 10.0.1 Release - -* Wed Jun 24 2020 sguelton@redhat.com - 10.0.0-2 -- Reproducible build of test.tar.gz, see rhbz#1820319 - -* Tue Apr 7 2020 sguelton@redhat.com - 10.0.0-1 -- 10.0.0 Release - -* Thu Feb 27 2020 Josh Stone - 9.0.1-4 -- Fix a codegen bug for Rust - -* Fri Jan 17 2020 Tom Stellard - 9.0.1-3 -- Add explicit Requires from sub-packages to llvm-libs - -* Fri Jan 10 2020 Tom Stellard - 9.0.1-2 -- Fix crash with kernel bpf self-tests - -* Thu Dec 19 2019 tstellar@redhat.com - 9.0.1-1 -- 9.0.1 Release - -* Wed Oct 30 2019 Tom Stellard - 9.0.0-5 -- Remove work-around for threading issue in gold - -* Wed Oct 30 2019 Tom Stellard - 9.0.0-4 -- Build libLLVM.so first to avoid OOM errors - -* Tue Oct 01 2019 Tom Stellard - 9.0.0-3 -- Adjust run-lit-tests script to better match in tree testing - -* Mon Sep 30 2019 Tom Stellard - 9.0.0-2 -- Limit number of build threads using -l option for ninja - -* Thu Sep 26 2019 Tom Stellard - 9.0.0-1 -- 9.0.0 Release - -* Thu Aug 1 2019 sguelton@redhat.com - 8.0.1-1 -- 8.0.1 release - -* Tue Jul 2 2019 sguelton@redhat.com - 8.0.1-0.3.rc2 -- Deactivate multithreading for gold plugin only to fix rhbz#1636479 - -* Mon Jun 17 2019 sguelton@redhat.com - 8.0.1-0.2.rc2 -- Deactivate multithreading instead of patching to fix rhbz#1636479 - -* Thu Jun 13 2019 sguelton@redhat.com - 8.0.1-0.1.rc2 -- 8.0.1rc2 Release - -* Tue May 14 2019 sguelton@redhat.com - 8.0.0-3 -- Disable threading in LTO - -* Wed May 8 2019 sguelton@redhat.com - 8.0.0-2 -- Fix conflicts between llvm-static = 8 and llvm-dev < 8 around LLVMStaticExports.cmake - -* Thu May 2 2019 sguelton@redhat.com - 8.0.0-1 -- 8.0.0 Release - -* Fri Dec 14 2018 Tom Stellard - 7.0.1-1 -- 7.0.1 Release - -* Thu Dec 13 2018 Tom Stellard - 7.0.1-0.5.rc3 -- Drop compat libs - -* Wed Dec 12 2018 Tom Stellard - 7.0.1-0.4.rc3 -- Fix ambiguous python shebangs - -* Tue Dec 11 2018 Tom Stellard - 7.0.1-0.3.rc3 -- Disable threading in thinLTO - -* Tue Dec 11 2018 Tom Stellard - 7.0.1-0.2.rc3 -- Update cmake options for compat build - -* Mon Dec 10 2018 Tom Stellard - 7.0.1-0.1.rc3 -- 7.0.1-rc3 Release - -* Fri Dec 07 2018 Tom Stellard - 6.0.1-14 -- Don't build llvm-test on i686 - -* Thu Dec 06 2018 Tom Stellard - 6.0.1-13 -- Fix build when python2 is not present on system - -* Tue Nov 06 2018 Tom Stellard - 6.0.1-12 -- Fix multi-lib installation of llvm-devel - -* Tue Oct 23 2018 Tom Stellard - 6.0.1-11 -- Add sub-packages for testing - -* Mon Oct 01 2018 Tom Stellard - 6.0.1-10 -- Drop scl macros - -* Tue Aug 28 2018 Tom Stellard - 6.0.1-9 -- Drop libedit dependency - -* Tue Aug 14 2018 Tom Stellard - 6.0.1-8 -- Only enabled valgrind functionality on arches that support it - -* Mon Aug 13 2018 Tom Stellard - 6.0.1-7 -- BuildRequires: python3-devel - -* Mon Aug 06 2018 Tom Stellard - 6.0.1-6 -- Backport fixes for rhbz#1610053, rhbz#1562196, rhbz#1595996 - -* Mon Aug 06 2018 Tom Stellard - 6.0.1-5 -- Fix ld.so.conf.d path in files list - -* Sat Aug 04 2018 Tom Stellard - 6.0.1-4 -- Fix ld.so.conf.d path - -* Fri Aug 03 2018 Tom Stellard - 6.0.1-3 -- Install ld.so.conf so llvm libs are in the library search path - -* Wed Jul 25 2018 Tom Stellard - 6.0.1-2 -- Re-enable doc package now that BREW-2381 is fixed - -* Tue Jul 10 2018 Tom Stellard - 6.0.1-1 -- 6.0.1 Release - -* Mon Jun 04 2018 Tom Stellard - 5.0.1-13 -- Limit build jobs on ppc64 to avoid OOM errors - -* Sat Jun 02 2018 Tom Stellard - 5.0.1-12 -- Switch to python3-sphinx - -* Thu May 31 2018 Tom Stellard - 5.0.1-11 -- Remove conditionals to enable building only the llvm-libs package, we don't - needs these for module builds. - -* Wed May 23 2018 Tom Stellard - 5.0.1-10 -- Add BuildRequires: libstdc++-static -- Resolves: #1580785 - -* Wed Apr 04 2018 Tom Stellard - 5.0.1-9 -- Add conditionals to enable building only the llvm-libs package - -* Tue Apr 03 2018 Tom Stellard - 5.0.1-8 -- Drop BuildRequires: libstdc++-static this package does not exist in RHEL8 - -* Tue Mar 20 2018 Tilmann Scheller - 5.0.1-7 -- Backport fix for rhbz#1558226 from trunk - -* Tue Mar 06 2018 Tilmann Scheller - 5.0.1-6 -- Backport fix for rhbz#1550469 from trunk - -* Thu Feb 22 2018 Tom Stellard - 5.0.1-5 -- Backport some retpoline fixes - -* Tue Feb 06 2018 Tom Stellard - 5.0.1-4 -- Backport retpoline support - -* Mon Jan 29 2018 Tom Stellard - 5.0.1-3 -- Backport r315279 to fix an issue with rust - -* Mon Jan 15 2018 Tom Stellard - 5.0.1-2 -- Drop ExculdeArch: ppc64 - -* Mon Jan 08 2018 Tom Stellard - 5.0.1-1 -- 5.0.1 Release - -* Thu Jun 22 2017 Tom Stellard - 4.0.1-3 -- Fix Requires for devel package again. - -* Thu Jun 22 2017 Tom Stellard - 4.0.1-2 -- Fix Requires for llvm-devel - -* Tue Jun 20 2017 Tom Stellard - 4.0.1-1 -- 4.0.1 Release - -* Mon Jun 05 2017 Tom Stellard - 4.0.0-5 -- Build for llvm-toolset-7 rename - -* Mon May 01 2017 Tom Stellard - 4.0.0-4 -- Remove multi-lib workarounds - -* Fri Apr 28 2017 Tom Stellard - 4.0.0-3 -- Fix build with llvm-toolset-4 scl - -* Mon Apr 03 2017 Tom Stellard - 4.0.0-2 -- Simplify spec with rpm macros. - -* Thu Mar 23 2017 Tom Stellard - 4.0.0-1 -- LLVM 4.0.0 Final Release - -* Wed Mar 22 2017 tstellar@redhat.com - 3.9.1-6 -- Fix %%postun sep for -devel package. - -* Mon Mar 13 2017 Tom Stellard - 3.9.1-5 -- Disable failing tests on ARM. - -* Sun Mar 12 2017 Peter Robinson 3.9.1-4 -- Fix missing mask on relocation for aarch64 (rhbz 1429050) - -* Wed Mar 01 2017 Dave Airlie - 3.9.1-3 -- revert upstream radeonsi breaking change. - -* Thu Feb 23 2017 Josh Stone - 3.9.1-2 -- disable sphinx warnings-as-errors - -* Fri Feb 10 2017 Orion Poplawski - 3.9.1-1 -- llvm 3.9.1 - -* Fri Feb 10 2017 Fedora Release Engineering - 3.9.0-8 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild - -* Tue Nov 29 2016 Josh Stone - 3.9.0-7 -- Apply backports from rust-lang/llvm#55, #57 - -* Tue Nov 01 2016 Dave Airlie - 3.9.0-5 -- apply the patch from -4 - -* Wed Oct 26 2016 Dave Airlie - 3.9.0-4 -- add fix for lldb out-of-tree build - -* Mon Oct 17 2016 Josh Stone - 3.9.0-3 -- Apply backports from rust-lang/llvm#47, #48, #53, #54 - -* Sat Oct 15 2016 Josh Stone - 3.9.0-2 -- Apply an InstCombine backport via rust-lang/llvm#51 - -* Wed Sep 07 2016 Dave Airlie - 3.9.0-1 -- llvm 3.9.0 -- upstream moved where cmake files are packaged. -- upstream dropped CppBackend - -* Wed Jul 13 2016 Adam Jackson - 3.8.1-1 -- llvm 3.8.1 -- Add mips target -- Fix some shared library mispackaging - -* Tue Jun 07 2016 Jan Vcelak - 3.8.0-2 -- fix color support detection on terminal - -* Thu Mar 10 2016 Dave Airlie 3.8.0-1 -- llvm 3.8.0 release - -* Wed Mar 09 2016 Dan Horák 3.8.0-0.3 -- install back memory consumption workaround for s390 - -* Thu Mar 03 2016 Dave Airlie 3.8.0-0.2 -- llvm 3.8.0 rc3 release - -* Fri Feb 19 2016 Dave Airlie 3.8.0-0.1 -- llvm 3.8.0 rc2 release - -* Tue Feb 16 2016 Dan Horák 3.7.1-7 -- recognize s390 as SystemZ when configuring build - -* Sat Feb 13 2016 Dave Airlie 3.7.1-6 -- export C++ API for mesa. - -* Sat Feb 13 2016 Dave Airlie 3.7.1-5 -- reintroduce llvm-static, clang needs it currently. - -* Fri Feb 12 2016 Dave Airlie 3.7.1-4 -- jump back to single llvm library, the split libs aren't working very well. - -* Fri Feb 05 2016 Dave Airlie 3.7.1-3 -- add missing obsoletes (#1303497) - -* Thu Feb 04 2016 Fedora Release Engineering - 3.7.1-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild - -* Thu Jan 07 2016 Jan Vcelak 3.7.1-1 -- new upstream release -- enable gold linker - -* Wed Nov 04 2015 Jan Vcelak 3.7.0-100 -- fix Requires for subpackages on the main package - -* Tue Oct 06 2015 Jan Vcelak 3.7.0-100 -- initial version using cmake build system +%include %{_sourcedir}/changelog