public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/llvm] rawhide: Remove support for old LLVM versions
@ 2026-09-25  6:36 Nikita Popov
  0 siblings, 0 replies; only message in thread
From: Nikita Popov @ 2026-09-25  6:36 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/llvm
            Branch : rawhide
            Commit : d46ee69d9c9db7f8ac2ff81adf0522fc2522a43a
            Author : Nikita Popov <npopov@redhat.com>
            Date   : 2026-09-24T15:01:59+00:00
            Stats  : +16/-2309 in 9 file(s)
            URL    : https://src.fedoraproject.org/rpms/llvm/c/d46ee69d9c9db7f8ac2ff81adf0522fc2522a43a?branch=rawhide

            Log:
            Remove support for old LLVM versions

This drops support for
 * compat_maj_ver 21, which means we can drop all the LLVM 21 specific
   patches, and
 * maj_ver 22, which means we can drop various conditionals.

I have retained one dead conditional for the build_docs toggle. The
reason is that pre-built man pages are incompatible with the
GIT_TREE build mode. We'll want to retain *some* support for not
having pre-built man pages to keep that working. I'm not touching
it in this PR to keep the change here mostly mechanical.

---
diff --git a/0001-20-polly-shared-libs.patch b/0001-20-polly-shared-libs.patch
deleted file mode 100644
index b0c90da..0000000
--- a/0001-20-polly-shared-libs.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-From cecb98f56e7d6619d0427fbdbc2f200ce212f0c6 Mon Sep 17 00:00:00 2001
-From: Konrad Kleine <kkleine@redhat.com>
-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/0001-BPF-Support-Jump-Table-149715.patch b/0001-BPF-Support-Jump-Table-149715.patch
deleted file mode 100644
index c1cbc12..0000000
--- a/0001-BPF-Support-Jump-Table-149715.patch
+++ /dev/null
@@ -1,1354 +0,0 @@
-From 528baf4740aed86443e3041eb3b6044963f96e1a Mon Sep 17 00:00:00 2001
-From: yonghong-song <yhs@fb.com>
-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 <reg>` insn is implemented and the `<reg>` 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<MCStreamer> 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<const BPFTargetMachine &>(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<GlobalVariable *> Targets;
-+    for (GlobalVariable &Global : M.globals()) {
-+      if (Global.getLinkage() != GlobalValue::PrivateLinkage)
-+        continue;
-+      if (!Global.isConstant() || !Global.hasInitializer())
-+        continue;
-+
-+      Constant *CV = dyn_cast<Constant>(Global.getInitializer());
-+      if (!CV)
-+        continue;
-+      ConstantArray *CA = dyn_cast<ConstantArray>(CV);
-+      if (!CA)
-+        continue;
-+
-+      for (unsigned i = 1, e = CA->getNumOperands(); i != e; ++i) {
-+        if (!dyn_cast<BlockAddress>(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<MCSymbolELF *>(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<MachineJumpTableEntry> &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<MachineBasicBlock *> 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<MCStreamer> 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<bool> BPFExpandMemcpyInOrder("bpf-expand-memcpy-in-order",
-   cl::Hidden, cl::init(false),
-   cl::desc("Expand memcpy into load/store pairs in order"));
- 
-+static cl::opt<unsigned> 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<JumpTableSDNode>(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 <class NodeTy>
- 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<BlockAddressSDNode>(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<BPFSubtarget>().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<const BasicBlock *, MachineBasicBlock *> 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<MachineBasicBlock *> 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<GlobalVariable>(GVal);
-+
-+  if (!GV || GV->getLinkage() != GlobalValue::PrivateLinkage ||
-+      !GV->isConstant() || !GV->hasInitializer())
-+    return emitLDImm64(GVal);
-+
-+  const auto *CA = dyn_cast<ConstantArray>(GV->getInitializer());
-+  if (!CA)
-+    return emitLDImm64(GVal);
-+
-+  for (const Use &Op : CA->operands()) {
-+    if (!isa<BlockAddress>(Op))
-+      return emitLDImm64(GVal);
-+    auto *BA = cast<BlockAddress>(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 <class NodeTy>
-   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<MachineOperand> 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<string name> : AsmOperandClass {
-   let Name = name;
-@@ -216,6 +217,18 @@ class JMP_RI<BPFJumpOp Opc, string OpcodeStr, PatLeaf Cond>
-   let BPFClass = BPF_JMP;
- }
- 
-+class JMP_IND<BPFJumpOp Opc, string OpcodeStr, list<dag> Pattern>
-+    : TYPE_ALU_JMP<Opc.Value, BPF_X.Value,
-+                   (outs),
-+                   (ins GPR:$dst),
-+                   !strconcat(OpcodeStr, " $dst"),
-+                   Pattern> {
-+  bits<4> dst;
-+
-+  let Inst{51-48} = dst;
-+  let BPFClass = BPF_JMP;
-+}
-+
- class JMP_JCOND<BPFJumpOp Opc, string OpcodeStr, list<dag> Pattern>
-     : TYPE_ALU_JMP<Opc.Value, BPF_K.Value,
-                    (outs),
-@@ -281,6 +294,12 @@ defm JSLT : J<BPF_JSLT, "s<", BPF_CC_LT, BPF_CC_LT_32>;
- defm JSLE : J<BPF_JSLE, "s<=", BPF_CC_LE, BPF_CC_LE_32>;
- defm JSET : J<BPF_JSET, "&", NoCond, NoCond>;
- def JCOND : JMP_JCOND<BPF_JCOND, "may_goto", []>;
-+
-+let Predicates = [BPFHasGotox] in {
-+  let isIndirectBranch = 1, isBarrier = 1 in {
-+    def JX : JMP_IND<BPF_JA, "gotox", [(brind i64:$dst)]>;
-+  }
-+}
- }
- 
- // 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<bool>
- static cl::opt<bool> 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<bool> 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<CallLowering> CallLoweringInfo;
-   std::unique_ptr<InstructionSelector> 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<TargetLoweringObjectFileELF>()),
-+      TLOF(std::make_unique<BPFTargetLoweringObjectFileELF>()),
-       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/0001-PowerPC-Add-check-for-cast-when-shufflevector-172443.patch b/0001-PowerPC-Add-check-for-cast-when-shufflevector-172443.patch
deleted file mode 100644
index 1f6c0ad..0000000
--- a/0001-PowerPC-Add-check-for-cast-when-shufflevector-172443.patch
+++ /dev/null
@@ -1,137 +0,0 @@
-From 98b82f90dfb7865ae4dbfcb5a83a9e817e7894a1 Mon Sep 17 00:00:00 2001
-From: Kevin Per <kevin.per@protonmail.com>
-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<ShuffleVectorSDNode>(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<ShuffleVectorSDNode>(Res))
-+      return Res;
-+
-     Mask = cast<ShuffleVectorSDNode>(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> <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 2, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
-+  %shuffle56 = shufflevector <32 x i32> %vecinit37, <32 x i32> %BS_ARG_1, <32 x i32> <i32 4, i32 9, i32 3, i32 3, i32 4, i32 1, i32 1, i32 0, i32 16, i32 5, i32 5, i32 34, i32 3, i32 0, i32 8, i32 2, i32 8, i32 1, i32 0, i32 0, i32 0, i32 1, i32 0, i32 0, i32 7, i32 5, i32 3, i32 6, i32 0, i32 3, i32 4, i32 7>
-+  ret <32 x i32> %shuffle56
-+}
--- 
-2.52.0
-

diff --git a/0001-SystemZ-Fix-code-in-widening-vector-multiplication-1.patch b/0001-SystemZ-Fix-code-in-widening-vector-multiplication-1.patch
deleted file mode 100644
index 4de2dc9..0000000
--- a/0001-SystemZ-Fix-code-in-widening-vector-multiplication-1.patch
+++ /dev/null
@@ -1,191 +0,0 @@
-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> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
-+  %zext1 = zext <8 x i8> %shuf1 to <8 x i16>
-+  %shuf2 = shufflevector <16 x i8> %val2, <16 x i8> poison, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
-+  %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> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
-+  %sext1 = sext <8 x i8> %shuf1 to <8 x i16>
-+  %shuf2 = shufflevector <16 x i8> %val2, <16 x i8> poison, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
-+  %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> <i32 0, i32 1, i32 2, i32 3>
-+  %zext1 = zext <4 x i16> %shuf1 to <4 x i32>
-+  %shuf2 = shufflevector <8 x i16> %val2, <8 x i16> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
-+  %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> <i32 0, i32 1, i32 2, i32 3>
-+  %sext1 = sext <4 x i16> %shuf1 to <4 x i32>
-+  %shuf2 = shufflevector <8 x i16> %val2, <8 x i16> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
-+  %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> <i32 0, i32 1>
-+  %zext1 = zext <2 x i32> %shuf1 to <2 x i64>
-+  %shuf2 = shufflevector <4 x i32> %val2, <4 x i32> poison, <2 x i32> <i32 0, i32 1>
-+  %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> <i32 0, i32 1>
-+  %sext1 = sext <2 x i32> %shuf1 to <2 x i64>
-+  %shuf2 = shufflevector <4 x i32> %val2, <4 x i32> poison, <2 x i32> <i32 0, i32 1>
-+  %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/0001-lld-Adjust-compressed-debug-level-test-for-s390x-wit.patch b/0001-lld-Adjust-compressed-debug-level-test-for-s390x-wit.patch
deleted file mode 100644
index 20dd146..0000000
--- a/0001-lld-Adjust-compressed-debug-level-test-for-s390x-wit.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 4fbbdb4f6b95158b87e1b072b3a246722ccf3b7d Mon Sep 17 00:00:00 2001
-From: Nikita Popov <npopov@redhat.com>
-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/0002-BPF-Remove-unused-weak-symbol-__bpf_trap-166003.patch b/0002-BPF-Remove-unused-weak-symbol-__bpf_trap-166003.patch
deleted file mode 100644
index 0c7e018..0000000
--- a/0002-BPF-Remove-unused-weak-symbol-__bpf_trap-166003.patch
+++ /dev/null
@@ -1,130 +0,0 @@
-From be4fa19ecf95d94d3ef46be183d3d4b4ebb6bb47 Mon Sep 17 00:00:00 2001
-From: yonghong-song <yhs@fb.com>
-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/0003-BPF-Remove-dead-code-related-to-__bpf_trap-global-va.patch b/0003-BPF-Remove-dead-code-related-to-__bpf_trap-global-va.patch
deleted file mode 100644
index 08de31e..0000000
--- a/0003-BPF-Remove-dead-code-related-to-__bpf_trap-global-va.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From ac5b6151976c70c8b676d3bc6ff82895fe0e1d01 Mon Sep 17 00:00:00 2001
-From: yonghong-song <yhs@fb.com>
-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/43cb4631c1f42dbfce78288b8ae30b5840ed59b3.patch b/43cb4631c1f42dbfce78288b8ae30b5840ed59b3.patch
deleted file mode 100644
index 47b333b..0000000
--- a/43cb4631c1f42dbfce78288b8ae30b5840ed59b3.patch
+++ /dev/null
@@ -1,276 +0,0 @@
-From 43cb4631c1f42dbfce78288b8ae30b5840ed59b3 Mon Sep 17 00:00:00 2001
-From: Ebuka Ezike <yerimyah1@gmail.com>
-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/llvm.spec b/llvm.spec
index 4248edb..1e1ff06 100644
--- a/llvm.spec
+++ b/llvm.spec
@@ -53,7 +53,7 @@
 %bcond_without check
 
 %if %{with bundle_compat_lib}
-%global compat_maj_ver 21
+%global compat_maj_ver 22
 %global compat_ver %{compat_maj_ver}.1.8
 %endif
 
@@ -205,7 +205,7 @@ end
 %else
 # Disable PGO on s390x temporarily in order to reduce LLVM build time and
 # disk usage.
-%if %{maj_ver} >= 23 && "%{_arch}" == "s390x"
+%ifarch s390x
 %bcond_with pgo
 %else
 %if 0%{?fedora} >= 43 || 0%{?rhel} >= 9
@@ -231,7 +231,7 @@ end
 %bcond_with lto_build
 %else
 # Disable LTO on s390x in order to reduce LLVM build time.
-%if %{maj_ver} >= 23 && "%{_arch}" == "s390x"
+%ifarch s390x
 %bcond_with pgo
 %else
 %if %{defined rhel} && 0%{?rhel} <= 8
@@ -257,7 +257,7 @@ end
 %global _lto_cflags %nil
 %endif
 
-%if %{maj_ver} >= 23 && 0%{undefined rhel} && %{without compat_build}
+%if 0%{undefined rhel} && %{without compat_build}
 %bcond_without libclc
 %else
 %bcond_with libclc
@@ -545,7 +545,6 @@ Source1001: changelog
 # behind the latest packaged LLVM version.
 
 #region CLANG patches
-Patch2100: 0001-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch
 Patch2200: 0001-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch
 Patch2300: 0001-23-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch
 Patch2400: 0001-23-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch
@@ -553,7 +552,6 @@ Patch102: 0003-PATCH-clang-Don-t-install-static-libraries.patch
 
 # Workaround a bug in ORC on ppc64le.
 # More info is available here: https://reviews.llvm.org/D159115#4641826
-Patch2107: 0001-21-Workaround-a-bug-in-ORC-on-ppc64le.patch
 Patch2218: 0001-21-Workaround-a-bug-in-ORC-on-ppc64le.patch
 Patch2303: 0001-21-Workaround-a-bug-in-ORC-on-ppc64le.patch
 Patch2402: 0001-24-Workaround-a-bug-in-ORC-on-ppc64le.patch
@@ -581,7 +579,6 @@ Patch2213: 0001-X86-Fix-EVEX-compression-for-VPMOV-2M-KMOV-with-tied.patch
 
 #region LLD patches
 Patch106: 0001-19-Always-build-shared-libs-for-LLD.patch
-Patch2103: 0001-lld-Adjust-compressed-debug-level-test-for-s390x-wit.patch
 Patch2214: 0001-ELF-Simplify-AArch64-relocateAlloc.-NFC.patch
 Patch2215: 0001-LLD-AArch64-Make-adrp-ldr-relaxation-per-symbol-all-.patch
 Patch2216: 0001-lld-ELF-Concatenate-.gnu.build.attributes.-sections-.patch
@@ -589,10 +586,7 @@ Patch2304: 224946.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
-Patch2401: 0001-22-polly-shared-libs.patch
+Patch107: 0001-22-polly-shared-libs.patch
 #endregion polly patches
 
 #region libclc patches
@@ -602,30 +596,13 @@ Patch2217: 207264.patch
 #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
 
 # 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
-
 # Disable tests when the execution engine is disabled.
 # https://github.com/llvm/llvm-project/pull/220741
 Patch2203: 0001-mlir-Disable-some-tests-when-the-execution-engine-is.patch
@@ -1462,13 +1439,6 @@ Mesa OpenCL support with RustiCL.
 # automatically apply patches based on LLVM version
 %autopatch -m%{compat_maj_ver}00 -M%{compat_maj_ver}99 -p1
 
-%if 0%{?rhel} == 8 && %{compat_maj_ver} < 22
-# The following patches have been backported from LLVM 22.
-%patch -p1 -P502
-%patch -p1 -P503
-%patch -p1 -P504
-%endif
-
 %endif
 
 # Unpack the man pages first
@@ -1881,15 +1851,6 @@ popd
   -DRUNTIMES_amdgcn-amd-amdhsa_CMAKE_STATIC_LINKER_FLAGS="" \\\
   -DRUNTIMES_nvptx64-nvidia-cuda_CMAKE_STATIC_LINKER_FLAGS="" \\\
   -DRUNTIMES_amdgcn-amd-amdhsa_LLVM_ENABLE_RUNTIMES="openmp"
-
-%if 0%{?__isa_bits} == 64 && %{maj_ver} <= 22
-# The following shouldn't be required, but due to a bug, we have to be
-# explicit about LLVM_LIBDIR_SUFFIX for nvptx64-nvidia-cuda.
-# This got fixed in LLVM 23.
-# 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
 
@@ -2193,12 +2154,6 @@ 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 \
@@ -2207,8 +2162,7 @@ cd ..
     -DLLVM_ENABLE_PROJECTS="clang;lldb" \
     -DLLVM_INCLUDE_BENCHMARKS=OFF \
     -DLLVM_INCLUDE_TESTS=OFF \
-    %{cmake_common_args} \
-    %{compat_lib_cmake_args}
+    %{cmake_common_args}
 
 
 
@@ -2545,13 +2499,9 @@ rm -v %{buildroot}%{install_libdir}/libFIRAnalysis.a \
       %{buildroot}%{install_libdir}/libMIFDialect.a
 
 
-%if %{maj_ver} < 23
-find %{buildroot}%{install_includedir}/flang -type f -a ! -iname '*.mod' -delete
-%else
 # Remove header files that are only needed for writing plugins.
 # TODO: Maybe we should package these in the future.
 rm -Rf %{buildroot}%{install_includedir}/flang
-%endif
 
 # this is a test binary
 rm -v %{buildroot}%{install_bindir}/f18-parse-demo
@@ -3325,6 +3275,7 @@ fi
     FileCheck
     llc
     lli
+    llubi
     llvm-addr2line
     llvm-ar
     llvm-as
@@ -3352,6 +3303,8 @@ fi
     llvm-dwp
     llvm-exegesis
     llvm-extract
+    llvm-extract-bundle-entry
+    llvm-gpu-loader
     llvm-gsymutil
     llvm-ifs
     llvm-install-name-tool
@@ -3411,18 +3364,6 @@ fi
     yaml2obj
 }}
 
-%if %{maj_ver} >= 23
-%{expand_bins %{expand:
-    llubi
-    llvm-extract-bundle-entry
-    llvm-gpu-loader
-}}
-%else
-%{expand_bins %{expand:
-    bugpoint
-}}
-%endif
-
 %if %{maj_ver} < 24
 %{expand_bins %{expand:
     llvm-sim
@@ -3441,6 +3382,7 @@ fi
     llc
     lldb-tblgen
     lli
+    llubi
     llvm-addr2line
     llvm-ar
     llvm-as
@@ -3456,6 +3398,7 @@ fi
     llvm-dwarfutil
     llvm-exegesis
     llvm-extract
+    llvm-extract-bundle-entry
     llvm-ifs
     llvm-install-name-tool
     llvm-ir2vec
@@ -3492,17 +3435,6 @@ fi
     tblgen
 }}
 
-%if %{maj_ver} >= 23
-%{expand_mans %{expand:
-    llubi
-    llvm-extract-bundle-entry
-}}
-%else
-%{expand_mans %{expand:
-    bugpoint
-}}
-%endif
-
 %if %{maj_ver} >= 24
 %{expand_mans %{expand:
   llvm-calc-occupancy
@@ -3719,6 +3651,9 @@ fi
     clang-refactor
     clang-reorder-fields
     clang-repl
+    clang-ssaf-analyzer
+    clang-ssaf-format
+    clang-ssaf-linker
     clang-sycl-linker
     clang-tidy
     clangd
@@ -3734,14 +3669,6 @@ fi
     offload-arch
 }}
 
-%if %{maj_ver} >= 23
-%{expand_bins %{expand:
-    clang-ssaf-analyzer
-    clang-ssaf-format
-    clang-ssaf-linker
-}}
-%endif
-
 %if %{maj_ver} >= 24
 %{expand_bins %{expand:
     clang-ssaf-src-edit-merge
@@ -3964,6 +3891,7 @@ fi
 
 %files -n %{pkg_name_mlir}-devel
 %{expand_bins %{expand:
+    mlir-irdl-to-cpp
     mlir-linalg-ods-yaml-gen
     mlir-lsp-server
     mlir-opt
@@ -3972,6 +3900,7 @@ fi
     mlir-query
     mlir-reduce
     mlir-rewrite
+    mlir-src-sharder
     mlir-tblgen
     mlir-translate
     tblgen-lsp-server
@@ -3982,12 +3911,6 @@ fi
     mlir-runner
 }}
 %endif
-%if %{maj_ver} >= 23
-%{expand_bins %{expand:
-    mlir-irdl-to-cpp
-    mlir-src-sharder
-}}
-%endif
 %expand_includes mlir mlir-c
 %{expand_libs %{expand:
     cmake/mlir
@@ -4027,14 +3950,8 @@ fi
 }}
 %{install_bindir}/flang-%{maj_ver}
 
-%if %{maj_ver} < 23
-%{expand_includes %{expand:
-    flang/*.mod
-}}
-%else
 %{_prefix}/lib/clang/%{maj_ver}/finclude/flang/%{llvm_triple}/*.mod
 %{_prefix}/lib/clang/%{maj_ver}/finclude/flang/%{llvm_triple}/omp_lib.h
-%endif
 
 %{_sysconfdir}/%{pkg_name_clang}/%{_target_platform}-flang.cfg
 %ifarch x86_64

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-25  6:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-25  6:36 [rpms/llvm] rawhide: Remove support for old LLVM versions Nikita Popov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox