Skip to content

[CodeGen] Rename expand-fp to expand-ir-insts - #172681

Merged
frederik-h merged 1 commit into
mainfrom
users/frederik-h/Rename_expand-fp_to_expand-ir-insts_to_better_reflect_its_functionality
Dec 18, 2025
Merged

frederik-h merged 1 commit into
mainfrom
users/frederik-h/Rename_expand-fp_to_expand-ir-insts_to_better_reflect_its_functionality

Conversation

@frederik-h

Copy link
Copy Markdown
Contributor

The pass now contains a non-fp expansion and should
be used for any similar expansions regardless of the
types involved. Hence a generic name seems apt.

Rename the source files, pass, and adjust the pass
description. Move all tests for the expansions
that have previously been merged into the pass
to a single directory.

frederik-h commented Dec 17, 2025 •

Copy link
Copy Markdown
Contributor Author

@frederik-h
frederik-h force-pushed the users/frederik-h/Rename_expand-fp_to_expand-ir-insts_to_better_reflect_its_functionality branch from 5903043 to 0304d78 Compare December 17, 2025 16:03
@github-actions

github-actions Bot commented Dec 17, 2025 •

Copy link
Copy Markdown

✅ With the latest revision this PR passed the C/C++ code formatter.

@llvmbot

llvmbot commented Dec 17, 2025 •

Copy link
Copy Markdown
Member

@llvm/pr-subscribers-backend-aarch64
@llvm/pr-subscribers-backend-loongarch
@llvm/pr-subscribers-backend-arm
@llvm/pr-subscribers-backend-risc-v
@llvm/pr-subscribers-backend-powerpc
@llvm/pr-subscribers-backend-spir-v
@llvm/pr-subscribers-backend-amdgpu

@llvm/pr-subscribers-backend-m68k

Author: Frederik Harwath (frederik-h)

Changes

The pass now contains a non-fp expansion and should
be used for any similar expansions regardless of the
types involved. Hence a generic name seems apt.

Rename the source files, pass, and adjust the pass
description. Move all tests for the expansions
that have previously been merged into the pass
to a single directory.


Patch is 67.80 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/172681.diff

52 Files Affected:

  • (modified) llvm/docs/WritingAnLLVMPass.rst (+1-1)
  • (renamed) llvm/include/llvm/CodeGen/ExpandIRInsts.h (+6-6)
  • (modified) llvm/include/llvm/CodeGen/Passes.h (+2-2)
  • (modified) llvm/include/llvm/CodeGen/TargetLowering.h (+6-6)
  • (modified) llvm/include/llvm/InitializePasses.h (+1-1)
  • (modified) llvm/include/llvm/Passes/CodeGenPassBuilder.h (+2-2)
  • (modified) llvm/lib/CodeGen/CMakeLists.txt (+1-1)
  • (modified) llvm/lib/CodeGen/CodeGen.cpp (+1-1)
  • (renamed) llvm/lib/CodeGen/ExpandIRInsts.cpp (+33-23)
  • (modified) llvm/lib/CodeGen/TargetPassConfig.cpp (+1-1)
  • (modified) llvm/lib/Passes/PassBuilder.cpp (+4-4)
  • (modified) llvm/lib/Passes/PassRegistry.def (+3-3)
  • (modified) llvm/test/CodeGen/AArch64/O0-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/AArch64/O3-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/AMDGPU/dagcombine-select.ll (+2-2)
  • (modified) llvm/test/CodeGen/AMDGPU/itofp.i128.bf.ll (+1-1)
  • (modified) llvm/test/CodeGen/AMDGPU/llc-pipeline-npm.ll (+3-3)
  • (modified) llvm/test/CodeGen/AMDGPU/llc-pipeline.ll (+5-5)
  • (modified) llvm/test/CodeGen/ARM/O3-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/LoongArch/O0-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/LoongArch/opt-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/M68k/pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/PowerPC/O0-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/PowerPC/O3-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/RISCV/O0-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/RISCV/O3-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/SPIRV/llc-pipeline.ll (+2-2)
  • (modified) llvm/test/CodeGen/X86/O0-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/X86/expand-large-fp-optnone.ll (+1-1)
  • (modified) llvm/test/CodeGen/X86/opt-pipeline.ll (+1-1)
  • (removed) llvm/test/Transforms/ExpandFp/AMDGPU/pass-parameters.ll (-20)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/AMDGPU/frem-inf.ll (+2-2)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/AMDGPU/frem.ll (+1-1)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/AMDGPU/lit.local.cfg ()
  • (renamed) llvm/test/Transforms/ExpandIRInsts/AMDGPU/missing-analysis.ll (+1-1)
  • (added) llvm/test/Transforms/ExpandIRInsts/AMDGPU/pass-parameters.ll (+20)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-convert-fptosi129.ll (+2-2)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-convert-fptoui129.ll (+2-2)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-convert-si129tofp.ll (+2-2)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-convert-ui129tofp.ll (+2-2)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-optnone.ll (+3-3)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/lit.local.cfg ()
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/sdiv129.ll (+2-2)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/srem129.ll (+2-2)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/udiv129.ll (+2-2)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/urem129.ll (+2-2)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/vector.ll (+2-2)
  • (removed) llvm/test/Transforms/ExpandLargeFpConvert/X86/lit.local.cfg (-2)
  • (modified) llvm/test/tools/opt/no-target-machine.ll (+2-2)
  • (modified) llvm/tools/opt/optdriver.cpp (+2-2)
  • (modified) llvm/utils/gn/secondary/llvm/lib/CodeGen/BUILD.gn (+1-1)
  • (modified) llvm/utils/profcheck-xfail.txt (+9-9)
diff --git a/llvm/docs/WritingAnLLVMPass.rst b/llvm/docs/WritingAnLLVMPass.rst
index f475676e15367..216e693087d96 100644
--- a/llvm/docs/WritingAnLLVMPass.rst
+++ b/llvm/docs/WritingAnLLVMPass.rst
@@ -673,7 +673,7 @@ default optimization pipelines, e.g. (the output has been trimmed):
   ModulePass Manager
   Pre-ISel Intrinsic Lowering
   FunctionPass Manager
-    Expand fp
+    Expand IR instructions
     Expand Atomic instructions
   SVE intrinsics optimizations
     FunctionPass Manager
diff --git a/llvm/include/llvm/CodeGen/ExpandFp.h b/llvm/include/llvm/CodeGen/ExpandIRInsts.h
similarity index 68%
rename from llvm/include/llvm/CodeGen/ExpandFp.h
rename to llvm/include/llvm/CodeGen/ExpandIRInsts.h
index 28e6aecc2beb5..5d3fcf75cd530 100644
--- a/llvm/include/llvm/CodeGen/ExpandFp.h
+++ b/llvm/include/llvm/CodeGen/ExpandIRInsts.h
@@ -1,4 +1,4 @@
-//===- ExpandFp.h -----------------------------------*- C++ -*-===//
+//===- ExpandIRInsts.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.
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CODEGEN_EXPANDFP_H
-#define LLVM_CODEGEN_EXPANDFP_H
+#ifndef LLVM_CODEGEN_EXPANDIRINSTS_H
+#define LLVM_CODEGEN_EXPANDIRINSTS_H
 
 #include "llvm/IR/PassManager.h"
 #include "llvm/Support/CodeGen.h"
@@ -16,13 +16,13 @@ namespace llvm {
 
 class TargetMachine;
 
-class ExpandFpPass : public PassInfoMixin<ExpandFpPass> {
+class ExpandIRInstsPass : public PassInfoMixin<ExpandIRInstsPass> {
 private:
   const TargetMachine *TM;
   CodeGenOptLevel OptLevel;
 
 public:
-  explicit ExpandFpPass(const TargetMachine &TM, CodeGenOptLevel OptLevel);
+  explicit ExpandIRInstsPass(const TargetMachine &TM, CodeGenOptLevel OptLevel);
 
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
   static bool isRequired() { return true; }
@@ -32,4 +32,4 @@ class ExpandFpPass : public PassInfoMixin<ExpandFpPass> {
 
 } // end namespace llvm
 
-#endif // LLVM_CODEGEN_EXPANDFP_H
+#endif // LLVM_CODEGEN_EXPANDIRINSTS_H
diff --git a/llvm/include/llvm/CodeGen/Passes.h b/llvm/include/llvm/CodeGen/Passes.h
index 08dabd69a48e9..fe19e6a32c680 100644
--- a/llvm/include/llvm/CodeGen/Passes.h
+++ b/llvm/include/llvm/CodeGen/Passes.h
@@ -547,7 +547,7 @@ LLVM_ABI FunctionPass *createExpandReductionsPass();
 LLVM_ABI FunctionPass *createReplaceWithVeclibLegacyPass();
 
 // Expands large div/rem instructions.
-LLVM_ABI FunctionPass *createExpandFpPass();
+LLVM_ABI FunctionPass *createExpandIRInstsPass();
 
 // This pass expands memcmp() to load/stores.
 LLVM_ABI FunctionPass *createExpandMemCmpLegacyPass();
@@ -565,7 +565,7 @@ LLVM_ABI FunctionPass *createCFIFixup();
 LLVM_ABI FunctionPass *createCFIInstrInserter();
 
 // Expands floating point instructions.
-FunctionPass *createExpandFpPass(CodeGenOptLevel);
+FunctionPass *createExpandIRInstsPass(CodeGenOptLevel);
 
 /// Creates CFGuard longjmp target identification pass.
 /// \see CFGuardLongjmp.cpp
diff --git a/llvm/include/llvm/CodeGen/TargetLowering.h b/llvm/include/llvm/CodeGen/TargetLowering.h
index 06bc5caefd063..8ad64a852b74d 100644
--- a/llvm/include/llvm/CodeGen/TargetLowering.h
+++ b/llvm/include/llvm/CodeGen/TargetLowering.h
@@ -2220,13 +2220,13 @@ class LLVM_ABI TargetLoweringBase {
   }
 
   /// Returns the size in bits of the maximum div/rem the backend supports.
-  /// Larger operations will be expanded by ExpandFp.
+  /// Larger operations will be expanded by ExpandIRInsts.
   unsigned getMaxDivRemBitWidthSupported() const {
     return MaxDivRemBitWidthSupported;
   }
 
   /// Returns the size in bits of the maximum fp to/from int conversion the
-  /// backend supports. Larger operations will be expanded by ExpandFp.
+  /// backend supports. Larger operations will be expanded by ExpandIRInsts.
   unsigned getMaxLargeFPConvertBitWidthSupported() const {
     return MaxLargeFPConvertBitWidthSupported;
   }
@@ -2886,13 +2886,13 @@ class LLVM_ABI TargetLoweringBase {
   }
 
   /// Set the size in bits of the maximum div/rem the backend supports.
-  /// Larger operations will be expanded by ExpandFp.
+  /// Larger operations will be expanded by ExpandIRInsts.
   void setMaxDivRemBitWidthSupported(unsigned SizeInBits) {
     MaxDivRemBitWidthSupported = SizeInBits;
   }
 
   /// Set the size in bits of the maximum fp to/from int conversion the backend
-  /// supports. Larger operations will be expanded by ExpandFp.
+  /// supports. Larger operations will be expanded by ExpandIRInsts.
   void setMaxLargeFPConvertBitWidthSupported(unsigned SizeInBits) {
     MaxLargeFPConvertBitWidthSupported = SizeInBits;
   }
@@ -3743,12 +3743,12 @@ class LLVM_ABI TargetLoweringBase {
   unsigned MaxAtomicSizeInBitsSupported;
 
   /// Size in bits of the maximum div/rem size the backend supports.
-  /// Larger operations will be expanded by ExpandFp.
+  /// Larger operations will be expanded by ExpandIRInsts.
   unsigned MaxDivRemBitWidthSupported;
 
   /// Size in bits of the maximum fp to/from int conversion size the
   /// backend supports. Larger operations will be expanded by
-  /// ExpandFp.
+  /// ExpandIRInsts.
   unsigned MaxLargeFPConvertBitWidthSupported;
 
   /// Size in bits of the minimum cmpxchg or ll/sc operation the
diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h
index b4f96674bea9e..2bc00a2f71e1a 100644
--- a/llvm/include/llvm/InitializePasses.h
+++ b/llvm/include/llvm/InitializePasses.h
@@ -112,7 +112,7 @@ LLVM_ABI void initializeEarlyMachineLICMPass(PassRegistry &);
 LLVM_ABI void initializeEarlyTailDuplicateLegacyPass(PassRegistry &);
 LLVM_ABI void initializeEdgeBundlesWrapperLegacyPass(PassRegistry &);
 LLVM_ABI void initializeEHContGuardTargetsPass(PassRegistry &);
-LLVM_ABI void initializeExpandFpLegacyPassPass(PassRegistry &);
+LLVM_ABI void initializeExpandIRInstsLegacyPassPass(PassRegistry &);
 LLVM_ABI void initializeExpandMemCmpLegacyPassPass(PassRegistry &);
 LLVM_ABI void initializeExpandPostRALegacyPass(PassRegistry &);
 LLVM_ABI void initializeExpandReductionsPass(PassRegistry &);
diff --git a/llvm/include/llvm/Passes/CodeGenPassBuilder.h b/llvm/include/llvm/Passes/CodeGenPassBuilder.h
index 0462adb835d89..9bf8e1976fad8 100644
--- a/llvm/include/llvm/Passes/CodeGenPassBuilder.h
+++ b/llvm/include/llvm/Passes/CodeGenPassBuilder.h
@@ -32,7 +32,7 @@
 #include "llvm/CodeGen/DetectDeadLanes.h"
 #include "llvm/CodeGen/DwarfEHPrepare.h"
 #include "llvm/CodeGen/EarlyIfConversion.h"
-#include "llvm/CodeGen/ExpandFp.h"
+#include "llvm/CodeGen/ExpandIRInsts.h"
 #include "llvm/CodeGen/ExpandMemCmp.h"
 #include "llvm/CodeGen/ExpandPostRAPseudos.h"
 #include "llvm/CodeGen/ExpandReductions.h"
@@ -677,7 +677,7 @@ void CodeGenPassBuilder<Derived, TargetMachineT>::addISelPasses(
     addModulePass(LowerEmuTLSPass(), PMW);
 
   addModulePass(PreISelIntrinsicLoweringPass(&TM), PMW);
-  addFunctionPass(ExpandFpPass(TM, getOptLevel()), PMW);
+  addFunctionPass(ExpandIRInstsPass(TM, getOptLevel()), PMW);
 
   derived().addIRPasses(PMW);
   derived().addCodeGenPrepare(PMW);
diff --git a/llvm/lib/CodeGen/CMakeLists.txt b/llvm/lib/CodeGen/CMakeLists.txt
index 8c9b172c0da65..871934ea4b76e 100644
--- a/llvm/lib/CodeGen/CMakeLists.txt
+++ b/llvm/lib/CodeGen/CMakeLists.txt
@@ -57,7 +57,7 @@ add_llvm_component_library(LLVMCodeGen
   EdgeBundles.cpp
   EHContGuardTargets.cpp
   ExecutionDomainFix.cpp
-  ExpandFp.cpp
+  ExpandIRInsts.cpp
   ExpandMemCmp.cpp
   ExpandPostRAPseudos.cpp
   ExpandReductions.cpp
diff --git a/llvm/lib/CodeGen/CodeGen.cpp b/llvm/lib/CodeGen/CodeGen.cpp
index 47633f89b70e9..3550eea13979a 100644
--- a/llvm/lib/CodeGen/CodeGen.cpp
+++ b/llvm/lib/CodeGen/CodeGen.cpp
@@ -39,7 +39,7 @@ void llvm::initializeCodeGen(PassRegistry &Registry) {
   initializeEarlyIfPredicatorPass(Registry);
   initializeEarlyMachineLICMPass(Registry);
   initializeEarlyTailDuplicateLegacyPass(Registry);
-  initializeExpandFpLegacyPassPass(Registry);
+  initializeExpandIRInstsLegacyPassPass(Registry);
   initializeExpandMemCmpLegacyPassPass(Registry);
   initializeExpandPostRALegacyPass(Registry);
   initializeFEntryInserterLegacyPass(Registry);
diff --git a/llvm/lib/CodeGen/ExpandFp.cpp b/llvm/lib/CodeGen/ExpandIRInsts.cpp
similarity index 95%
rename from llvm/lib/CodeGen/ExpandFp.cpp
rename to llvm/lib/CodeGen/ExpandIRInsts.cpp
index 395fef19a13b9..1d09000fbca6b 100644
--- a/llvm/lib/CodeGen/ExpandFp.cpp
+++ b/llvm/lib/CodeGen/ExpandIRInsts.cpp
@@ -1,26 +1,33 @@
-//===--- ExpandFp.cpp - Expand fp instructions ----------------------------===//
+//===--- ExpandIRInsts.cpp - Expand IR instructions -----------------------===//
 //
 // 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
 //
 //===----------------------------------------------------------------------===//
-// This pass expands certain floating point instructions at the IR level.
+// This pass expands certain instructions at the IR level.
 //
-// It expands ‘fptoui .. to’, ‘fptosi .. to’, ‘uitofp ..  to’, ‘sitofp
+// The following expansions are implemented:
+// - Expansion of ‘fptoui .. to’, ‘fptosi .. to’, ‘uitofp ..  to’, ‘sitofp
 // .. to’ instructions with a bitwidth above a threshold.  This is
 // useful for targets like x86_64 that cannot lower fp convertions
 // with more than 128 bits.
 //
-// This pass also expands div/rem instructions with a bitwidth above a
-// threshold into a call to auto-generated functions.  This is useful
-// for targets like x86_64 that cannot lower divisions with more than
-// 128 bits or targets like x86_32 that cannot lower divisions with
-// more than 64 bits.
+// - Expansion of ‘frem‘ for types MVT::f16, MVT::f32, and MVT::f64 for
+// targets which use "Expand" as the legalization action for the
+// corresponding type.
 //
+// - Expansion of ‘udiv‘, ‘sdiv‘, ‘urem‘, and ‘srem‘ instructions with
+// a bitwidth above a threshold into a call to auto-generated
+// functions.  This is useful for targets like x86_64 that cannot
+// lower divisions with more than 128 bits or targets like x86_32 that
+// cannot lower divisions with more than 64 bits.
+//
+// Instructions with vector types are scalarized first if their scalar
+// types can be expanded. Scalable vector types are not supported.
 //===----------------------------------------------------------------------===//
 
-#include "llvm/CodeGen/ExpandFp.h"
+#include "llvm/CodeGen/ExpandIRInsts.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Analysis/AssumptionCache.h"
 #include "llvm/Analysis/GlobalsModRef.h"
@@ -45,7 +52,7 @@
 #include <llvm/Support/Casting.h>
 #include <optional>
 
-#define DEBUG_TYPE "expand-fp"
+#define DEBUG_TYPE "expand-ir-insts"
 
 using namespace llvm;
 
@@ -1125,18 +1132,18 @@ static bool runImpl(Function &F, const TargetLowering &TLI,
 }
 
 namespace {
-class ExpandFpLegacyPass : public FunctionPass {
+class ExpandIRInstsLegacyPass : public FunctionPass {
   CodeGenOptLevel OptLevel;
 
 public:
   static char ID;
 
-  ExpandFpLegacyPass(CodeGenOptLevel OptLevel)
+  ExpandIRInstsLegacyPass(CodeGenOptLevel OptLevel)
       : FunctionPass(ID), OptLevel(OptLevel) {
-    initializeExpandFpLegacyPassPass(*PassRegistry::getPassRegistry());
+    initializeExpandIRInstsLegacyPassPass(*PassRegistry::getPassRegistry());
   }
 
-  ExpandFpLegacyPass() : ExpandFpLegacyPass(CodeGenOptLevel::None) {};
+  ExpandIRInstsLegacyPass() : ExpandIRInstsLegacyPass(CodeGenOptLevel::None) {};
 
   bool runOnFunction(Function &F) override {
     auto *TM = &getAnalysis<TargetPassConfig>().getTM<TargetMachine>();
@@ -1165,19 +1172,21 @@ class ExpandFpLegacyPass : public FunctionPass {
 };
 } // namespace
 
-ExpandFpPass::ExpandFpPass(const TargetMachine &TM, CodeGenOptLevel OptLevel)
+ExpandIRInstsPass::ExpandIRInstsPass(const TargetMachine &TM,
+                                     CodeGenOptLevel OptLevel)
     : TM(&TM), OptLevel(OptLevel) {}
 
-void ExpandFpPass::printPipeline(
+void ExpandIRInstsPass::printPipeline(
     raw_ostream &OS, function_ref<StringRef(StringRef)> MapClassName2PassName) {
-  static_cast<PassInfoMixin<ExpandFpPass> *>(this)->printPipeline(
+  static_cast<PassInfoMixin<ExpandIRInstsPass> *>(this)->printPipeline(
       OS, MapClassName2PassName);
   OS << '<';
   OS << "O" << (int)OptLevel;
   OS << '>';
 }
 
-PreservedAnalyses ExpandFpPass::run(Function &F, FunctionAnalysisManager &FAM) {
+PreservedAnalyses ExpandIRInstsPass::run(Function &F,
+                                         FunctionAnalysisManager &FAM) {
   const TargetSubtargetInfo *STI = TM->getSubtargetImpl(F);
   auto &TLI = *STI->getTargetLowering();
   AssumptionCache *AC = nullptr;
@@ -1202,12 +1211,13 @@ PreservedAnalyses ExpandFpPass::run(Function &F, FunctionAnalysisManager &FAM) {
                                        : PreservedAnalyses::all();
 }
 
-char ExpandFpLegacyPass::ID = 0;
-INITIALIZE_PASS_BEGIN(ExpandFpLegacyPass, "expand-fp",
+char ExpandIRInstsLegacyPass::ID = 0;
+INITIALIZE_PASS_BEGIN(ExpandIRInstsLegacyPass, "expand-ir-insts",
                       "Expand certain fp instructions", false, false)
 INITIALIZE_PASS_DEPENDENCY(LibcallLoweringInfoWrapper)
-INITIALIZE_PASS_END(ExpandFpLegacyPass, "expand-fp", "Expand fp", false, false)
+INITIALIZE_PASS_END(ExpandIRInstsLegacyPass, "expand-ir-insts",
+                    "Expand IR instructions", false, false)
 
-FunctionPass *llvm::createExpandFpPass(CodeGenOptLevel OptLevel) {
-  return new ExpandFpLegacyPass(OptLevel);
+FunctionPass *llvm::createExpandIRInstsPass(CodeGenOptLevel OptLevel) {
+  return new ExpandIRInstsLegacyPass(OptLevel);
 }
diff --git a/llvm/lib/CodeGen/TargetPassConfig.cpp b/llvm/lib/CodeGen/TargetPassConfig.cpp
index acceb66468409..ca75d3b47cf3a 100644
--- a/llvm/lib/CodeGen/TargetPassConfig.cpp
+++ b/llvm/lib/CodeGen/TargetPassConfig.cpp
@@ -1090,7 +1090,7 @@ bool TargetPassConfig::addISelPasses() {
 
   PM->add(createTargetTransformInfoWrapperPass(TM->getTargetIRAnalysis()));
   addPass(createPreISelIntrinsicLoweringPass());
-  addPass(createExpandFpPass(getOptLevel()));
+  addPass(createExpandIRInstsPass(getOptLevel()));
   addIRPasses();
   addCodeGenPrepare();
   addPassesToHandleExceptions();
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index d639c24664ad1..84ee043b5da56 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -91,7 +91,7 @@
 #include "llvm/CodeGen/DwarfEHPrepare.h"
 #include "llvm/CodeGen/EarlyIfConversion.h"
 #include "llvm/CodeGen/EdgeBundles.h"
-#include "llvm/CodeGen/ExpandFp.h"
+#include "llvm/CodeGen/ExpandIRInsts.h"
 #include "llvm/CodeGen/ExpandMemCmp.h"
 #include "llvm/CodeGen/ExpandPostRAPseudos.h"
 #include "llvm/CodeGen/ExpandReductions.h"
@@ -1632,7 +1632,7 @@ parseBoundsCheckingOptions(StringRef Params) {
   return Options;
 }
 
-Expected<CodeGenOptLevel> parseExpandFpOptions(StringRef Param) {
+Expected<CodeGenOptLevel> parseExpandIRInstsOptions(StringRef Param) {
   if (Param.empty())
     return CodeGenOptLevel::None;
 
@@ -1641,13 +1641,13 @@ Expected<CodeGenOptLevel> parseExpandFpOptions(StringRef Param) {
 
   uint8_t N;
   if (!Prefix.empty() || Digit.getAsInteger(10, N))
-    return createStringError("invalid expand-fp pass parameter '%s'",
+    return createStringError("invalid expand-ir-insts pass parameter '%s'",
                              Param.str().c_str());
 
   std::optional<CodeGenOptLevel> Level = CodeGenOpt::getLevel(N);
   if (!Level.has_value())
     return createStringError(
-        "invalid optimization level for expand-fp pass: %s",
+        "invalid optimization level for expand-ir-insts pass: %s",
         Digit.str().c_str());
 
   return *Level;
diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def
index 14215bb32e777..daf6b3d6dbd28 100644
--- a/llvm/lib/Passes/PassRegistry.def
+++ b/llvm/lib/Passes/PassRegistry.def
@@ -729,11 +729,11 @@ FUNCTION_PASS_WITH_PARAMS(
     parseBoundsCheckingOptions,
     "trap;rt;rt-abort;min-rt;min-rt-abort;merge;guard=N")
 FUNCTION_PASS_WITH_PARAMS(
-    "expand-fp", "ExpandFpPass",
+    "expand-ir-insts", "ExpandIRInstsPass",
     [TM = TM](CodeGenOptLevel OL) {
-      return ExpandFpPass(*TM, OL);
+      return ExpandIRInstsPass(*TM, OL);
     },
-    parseExpandFpOptions, "O0;O1;O2;O3")
+    parseExpandIRInstsOptions, "O0;O1;O2;O3")
 
 #undef FUNCTION_PASS_WITH_PARAMS
 
diff --git a/llvm/test/CodeGen/AArch64/O0-pipeline.ll b/llvm/test/CodeGen/AArch64/O0-pipeline.ll
index 2a1264446c70d..f4f9d38336608 100644
--- a/llvm/test/CodeGen/AArch64/O0-pipeline.ll
+++ b/llvm/test/CodeGen/AArch64/O0-pipeline.ll
@@ -17,7 +17,7 @@
 ; CHECK-NEXT:   ModulePass Manager
 ; CHECK-NEXT:     Pre-ISel Intrinsic Lowering
 ; CHECK-NEXT:     FunctionPass Manager
-; CHECK-NEXT:       Expand fp
+; CHECK-NEXT:       Expand IR instructions
 ; CHECK-NEXT:       Expand Atomic instructions
 ; CHECK-NEXT:       Module Verifier
 ; CHECK-NEXT:       Lower Garbage Collection Instructions
diff --git a/llvm/test/CodeGen/AArch64/O3-pipeline.ll b/llvm/test/CodeGen/AArch64/O3-pipeline.ll
index 4dc3cd1d6b786..f6ed7d5eed814 100644
--- a/llvm/test/CodeGen/AArch64/O3-pipeline.ll
+++ b/llvm/test/CodeGen/AArch64/O3-pipeline.ll
@@ -21,7 +21,7 @@
 ; CHECK-NEXT:   ModulePass Manager
 ; CHECK-NEXT:     Pre-ISel Intrinsic Lowering
 ; CHECK-NEXT:     FunctionPass Manager
-; CHECK-NEXT:       Expand fp
+; CHECK-NEXT:       Expand IR instructions
 ; CHECK-NEXT:       Expand Atomic instructions
 ; CHECK-NEXT:     SVE intrinsics optimizations
 ; CHECK-NEXT:       FunctionPass Manager
diff --git a/llvm/test/CodeGen/AMDGPU/dagcombine-select.ll b/llvm/test/CodeGen/AMDGPU/dagcombine-select.ll
index 39365fe7b6f15..c828f0b538bec 100644
--- a/llvm/test/CodeGen/AMDGPU/dagcombine-select.ll
+++ b/llvm/test/CodeGen/AMDGPU/dagcombine-select.ll
@@ -579,8 +579,8 @@ define amdgpu_kernel void @fdiv_constant_sel_constants(ptr addrspace(1) %p, i1 %
   ret void
 }
 
-; ExpandFp now expands frem before it reaches dagcombine.
-; TODO Implement this optimization in/before ExpandFP
+; ExpandIRInsts now expands frem before it reaches dagcombine.
+; TODO Implement this optimization in/before ExpandIRInsts?
 define amdgpu_kernel void @frem_constant_sel_constants(ptr addrspace(1) %p, i1 %cond) {
 ; GFX9-LABEL: frem_constant_sel_constants:
 ; GFX9:       ; %bb.0:
diff --git a/llvm/test/CodeGen/AMDGPU/itofp.i128.bf.ll b/llvm/test/CodeGen/AMDGPU/itofp.i128.bf.ll
index c001df48499c7..eee3352fa7452 100644
--- a/llvm/test/CodeGen/AMDGPU/itofp.i128.bf.ll
+++ b/llvm/test/CodeGen/AMDGPU/itofp.i128.bf.ll
@@ -2,7 +2,7 @@
 ; RUN: llc -global-isel=0 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 < %s | FileCheck -check-prefixes=GCN,SDAG %s
 ; RUN: not --crash llc -global-isel=1 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 < %s 2>&1 | FileCheck -check-prefix=GISEL %s
 
-; FIXME: GISEL can't handle the "fptrunc float to bfloat" that expand-fp emits.
+; FIXME: GISEL can't handle the "fptrunc float to bfloat" that expand-ir-insts emits.
 
 ; GISEL: unable to translate instruction: fptrunc
 
diff --git a/llvm/test/CodeGen/AMDGPU/llc-pipeline-npm.ll b/llvm/test/CodeGen/AMDGPU/llc-pipeline-npm.ll
index edf4b6f26d08e..61c751a9816a2 100644
--- a/llvm/test/CodeGen/AMDGPU/llc-pipeline-npm.ll
+++ b/llvm/test/CodeGen/AMDGPU/llc-pipeline-npm.ll
@@ -9,11 +9,11 @@
 ; RUN:   | FileCheck -check-prefix=GCN-O3 %s
 
 
-; GCN-O0: require<MachineModuleAnalysis>,require<profile-summary>,require<collector-metadata>,require<runtime-libcall-info>,pre-isel-intrinsic-lowering,function(expand-fp<O0>),amdgpu-remove-incompatible-functions,amdgpu-printf-runtime-binding,amdgpu-lower-ctor-dtor,function(amdgpu-uniform-intrinsic-combine),expand-variadics,amdgpu-always-inline,always-inline,amdgpu-export-kernel-runtime-handles,amdgpu-lower-exec-sync,amdgpu-sw-lower-lds,amdgpu-lower-module-lds,function(atomic-expand,verify,gc-lowering,lower-constant-intrinsics,unreachableblockelim,ee-instrument<post-inline>,scalarize-masked-mem-intrin,expand-reductions,amdgpu-lower-kernel-arguments),amdgpu-lower-buffer-fat-pointers,amdgpu-lower-intrinsics,cgscc(function(lower-switch,lower-invoke,unreachableblockelim)),require<amdgpu-argument-usage>,cgscc(function(amdgp...
[truncated]

@llvmbot

llvmbot commented Dec 17, 2025

Copy link
Copy Markdown
Member

@llvm/pr-subscribers-backend-arm

Author: Frederik Harwath (frederik-h)

Changes

The pass now contains a non-fp expansion and should
be used for any similar expansions regardless of the
types involved. Hence a generic name seems apt.

Rename the source files, pass, and adjust the pass
description. Move all tests for the expansions
that have previously been merged into the pass
to a single directory.


Patch is 67.80 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/172681.diff

52 Files Affected:

  • (modified) llvm/docs/WritingAnLLVMPass.rst (+1-1)
  • (renamed) llvm/include/llvm/CodeGen/ExpandIRInsts.h (+6-6)
  • (modified) llvm/include/llvm/CodeGen/Passes.h (+2-2)
  • (modified) llvm/include/llvm/CodeGen/TargetLowering.h (+6-6)
  • (modified) llvm/include/llvm/InitializePasses.h (+1-1)
  • (modified) llvm/include/llvm/Passes/CodeGenPassBuilder.h (+2-2)
  • (modified) llvm/lib/CodeGen/CMakeLists.txt (+1-1)
  • (modified) llvm/lib/CodeGen/CodeGen.cpp (+1-1)
  • (renamed) llvm/lib/CodeGen/ExpandIRInsts.cpp (+33-23)
  • (modified) llvm/lib/CodeGen/TargetPassConfig.cpp (+1-1)
  • (modified) llvm/lib/Passes/PassBuilder.cpp (+4-4)
  • (modified) llvm/lib/Passes/PassRegistry.def (+3-3)
  • (modified) llvm/test/CodeGen/AArch64/O0-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/AArch64/O3-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/AMDGPU/dagcombine-select.ll (+2-2)
  • (modified) llvm/test/CodeGen/AMDGPU/itofp.i128.bf.ll (+1-1)
  • (modified) llvm/test/CodeGen/AMDGPU/llc-pipeline-npm.ll (+3-3)
  • (modified) llvm/test/CodeGen/AMDGPU/llc-pipeline.ll (+5-5)
  • (modified) llvm/test/CodeGen/ARM/O3-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/LoongArch/O0-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/LoongArch/opt-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/M68k/pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/PowerPC/O0-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/PowerPC/O3-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/RISCV/O0-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/RISCV/O3-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/SPIRV/llc-pipeline.ll (+2-2)
  • (modified) llvm/test/CodeGen/X86/O0-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/X86/expand-large-fp-optnone.ll (+1-1)
  • (modified) llvm/test/CodeGen/X86/opt-pipeline.ll (+1-1)
  • (removed) llvm/test/Transforms/ExpandFp/AMDGPU/pass-parameters.ll (-20)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/AMDGPU/frem-inf.ll (+2-2)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/AMDGPU/frem.ll (+1-1)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/AMDGPU/lit.local.cfg ()
  • (renamed) llvm/test/Transforms/ExpandIRInsts/AMDGPU/missing-analysis.ll (+1-1)
  • (added) llvm/test/Transforms/ExpandIRInsts/AMDGPU/pass-parameters.ll (+20)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-convert-fptosi129.ll (+2-2)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-convert-fptoui129.ll (+2-2)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-convert-si129tofp.ll (+2-2)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-convert-ui129tofp.ll (+2-2)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-optnone.ll (+3-3)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/lit.local.cfg ()
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/sdiv129.ll (+2-2)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/srem129.ll (+2-2)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/udiv129.ll (+2-2)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/urem129.ll (+2-2)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/vector.ll (+2-2)
  • (removed) llvm/test/Transforms/ExpandLargeFpConvert/X86/lit.local.cfg (-2)
  • (modified) llvm/test/tools/opt/no-target-machine.ll (+2-2)
  • (modified) llvm/tools/opt/optdriver.cpp (+2-2)
  • (modified) llvm/utils/gn/secondary/llvm/lib/CodeGen/BUILD.gn (+1-1)
  • (modified) llvm/utils/profcheck-xfail.txt (+9-9)
diff --git a/llvm/docs/WritingAnLLVMPass.rst b/llvm/docs/WritingAnLLVMPass.rst
index f475676e15367..216e693087d96 100644
--- a/llvm/docs/WritingAnLLVMPass.rst
+++ b/llvm/docs/WritingAnLLVMPass.rst
@@ -673,7 +673,7 @@ default optimization pipelines, e.g. (the output has been trimmed):
   ModulePass Manager
   Pre-ISel Intrinsic Lowering
   FunctionPass Manager
-    Expand fp
+    Expand IR instructions
     Expand Atomic instructions
   SVE intrinsics optimizations
     FunctionPass Manager
diff --git a/llvm/include/llvm/CodeGen/ExpandFp.h b/llvm/include/llvm/CodeGen/ExpandIRInsts.h
similarity index 68%
rename from llvm/include/llvm/CodeGen/ExpandFp.h
rename to llvm/include/llvm/CodeGen/ExpandIRInsts.h
index 28e6aecc2beb5..5d3fcf75cd530 100644
--- a/llvm/include/llvm/CodeGen/ExpandFp.h
+++ b/llvm/include/llvm/CodeGen/ExpandIRInsts.h
@@ -1,4 +1,4 @@
-//===- ExpandFp.h -----------------------------------*- C++ -*-===//
+//===- ExpandIRInsts.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.
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CODEGEN_EXPANDFP_H
-#define LLVM_CODEGEN_EXPANDFP_H
+#ifndef LLVM_CODEGEN_EXPANDIRINSTS_H
+#define LLVM_CODEGEN_EXPANDIRINSTS_H
 
 #include "llvm/IR/PassManager.h"
 #include "llvm/Support/CodeGen.h"
@@ -16,13 +16,13 @@ namespace llvm {
 
 class TargetMachine;
 
-class ExpandFpPass : public PassInfoMixin<ExpandFpPass> {
+class ExpandIRInstsPass : public PassInfoMixin<ExpandIRInstsPass> {
 private:
   const TargetMachine *TM;
   CodeGenOptLevel OptLevel;
 
 public:
-  explicit ExpandFpPass(const TargetMachine &TM, CodeGenOptLevel OptLevel);
+  explicit ExpandIRInstsPass(const TargetMachine &TM, CodeGenOptLevel OptLevel);
 
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
   static bool isRequired() { return true; }
@@ -32,4 +32,4 @@ class ExpandFpPass : public PassInfoMixin<ExpandFpPass> {
 
 } // end namespace llvm
 
-#endif // LLVM_CODEGEN_EXPANDFP_H
+#endif // LLVM_CODEGEN_EXPANDIRINSTS_H
diff --git a/llvm/include/llvm/CodeGen/Passes.h b/llvm/include/llvm/CodeGen/Passes.h
index 08dabd69a48e9..fe19e6a32c680 100644
--- a/llvm/include/llvm/CodeGen/Passes.h
+++ b/llvm/include/llvm/CodeGen/Passes.h
@@ -547,7 +547,7 @@ LLVM_ABI FunctionPass *createExpandReductionsPass();
 LLVM_ABI FunctionPass *createReplaceWithVeclibLegacyPass();
 
 // Expands large div/rem instructions.
-LLVM_ABI FunctionPass *createExpandFpPass();
+LLVM_ABI FunctionPass *createExpandIRInstsPass();
 
 // This pass expands memcmp() to load/stores.
 LLVM_ABI FunctionPass *createExpandMemCmpLegacyPass();
@@ -565,7 +565,7 @@ LLVM_ABI FunctionPass *createCFIFixup();
 LLVM_ABI FunctionPass *createCFIInstrInserter();
 
 // Expands floating point instructions.
-FunctionPass *createExpandFpPass(CodeGenOptLevel);
+FunctionPass *createExpandIRInstsPass(CodeGenOptLevel);
 
 /// Creates CFGuard longjmp target identification pass.
 /// \see CFGuardLongjmp.cpp
diff --git a/llvm/include/llvm/CodeGen/TargetLowering.h b/llvm/include/llvm/CodeGen/TargetLowering.h
index 06bc5caefd063..8ad64a852b74d 100644
--- a/llvm/include/llvm/CodeGen/TargetLowering.h
+++ b/llvm/include/llvm/CodeGen/TargetLowering.h
@@ -2220,13 +2220,13 @@ class LLVM_ABI TargetLoweringBase {
   }
 
   /// Returns the size in bits of the maximum div/rem the backend supports.
-  /// Larger operations will be expanded by ExpandFp.
+  /// Larger operations will be expanded by ExpandIRInsts.
   unsigned getMaxDivRemBitWidthSupported() const {
     return MaxDivRemBitWidthSupported;
   }
 
   /// Returns the size in bits of the maximum fp to/from int conversion the
-  /// backend supports. Larger operations will be expanded by ExpandFp.
+  /// backend supports. Larger operations will be expanded by ExpandIRInsts.
   unsigned getMaxLargeFPConvertBitWidthSupported() const {
     return MaxLargeFPConvertBitWidthSupported;
   }
@@ -2886,13 +2886,13 @@ class LLVM_ABI TargetLoweringBase {
   }
 
   /// Set the size in bits of the maximum div/rem the backend supports.
-  /// Larger operations will be expanded by ExpandFp.
+  /// Larger operations will be expanded by ExpandIRInsts.
   void setMaxDivRemBitWidthSupported(unsigned SizeInBits) {
     MaxDivRemBitWidthSupported = SizeInBits;
   }
 
   /// Set the size in bits of the maximum fp to/from int conversion the backend
-  /// supports. Larger operations will be expanded by ExpandFp.
+  /// supports. Larger operations will be expanded by ExpandIRInsts.
   void setMaxLargeFPConvertBitWidthSupported(unsigned SizeInBits) {
     MaxLargeFPConvertBitWidthSupported = SizeInBits;
   }
@@ -3743,12 +3743,12 @@ class LLVM_ABI TargetLoweringBase {
   unsigned MaxAtomicSizeInBitsSupported;
 
   /// Size in bits of the maximum div/rem size the backend supports.
-  /// Larger operations will be expanded by ExpandFp.
+  /// Larger operations will be expanded by ExpandIRInsts.
   unsigned MaxDivRemBitWidthSupported;
 
   /// Size in bits of the maximum fp to/from int conversion size the
   /// backend supports. Larger operations will be expanded by
-  /// ExpandFp.
+  /// ExpandIRInsts.
   unsigned MaxLargeFPConvertBitWidthSupported;
 
   /// Size in bits of the minimum cmpxchg or ll/sc operation the
diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h
index b4f96674bea9e..2bc00a2f71e1a 100644
--- a/llvm/include/llvm/InitializePasses.h
+++ b/llvm/include/llvm/InitializePasses.h
@@ -112,7 +112,7 @@ LLVM_ABI void initializeEarlyMachineLICMPass(PassRegistry &);
 LLVM_ABI void initializeEarlyTailDuplicateLegacyPass(PassRegistry &);
 LLVM_ABI void initializeEdgeBundlesWrapperLegacyPass(PassRegistry &);
 LLVM_ABI void initializeEHContGuardTargetsPass(PassRegistry &);
-LLVM_ABI void initializeExpandFpLegacyPassPass(PassRegistry &);
+LLVM_ABI void initializeExpandIRInstsLegacyPassPass(PassRegistry &);
 LLVM_ABI void initializeExpandMemCmpLegacyPassPass(PassRegistry &);
 LLVM_ABI void initializeExpandPostRALegacyPass(PassRegistry &);
 LLVM_ABI void initializeExpandReductionsPass(PassRegistry &);
diff --git a/llvm/include/llvm/Passes/CodeGenPassBuilder.h b/llvm/include/llvm/Passes/CodeGenPassBuilder.h
index 0462adb835d89..9bf8e1976fad8 100644
--- a/llvm/include/llvm/Passes/CodeGenPassBuilder.h
+++ b/llvm/include/llvm/Passes/CodeGenPassBuilder.h
@@ -32,7 +32,7 @@
 #include "llvm/CodeGen/DetectDeadLanes.h"
 #include "llvm/CodeGen/DwarfEHPrepare.h"
 #include "llvm/CodeGen/EarlyIfConversion.h"
-#include "llvm/CodeGen/ExpandFp.h"
+#include "llvm/CodeGen/ExpandIRInsts.h"
 #include "llvm/CodeGen/ExpandMemCmp.h"
 #include "llvm/CodeGen/ExpandPostRAPseudos.h"
 #include "llvm/CodeGen/ExpandReductions.h"
@@ -677,7 +677,7 @@ void CodeGenPassBuilder<Derived, TargetMachineT>::addISelPasses(
     addModulePass(LowerEmuTLSPass(), PMW);
 
   addModulePass(PreISelIntrinsicLoweringPass(&TM), PMW);
-  addFunctionPass(ExpandFpPass(TM, getOptLevel()), PMW);
+  addFunctionPass(ExpandIRInstsPass(TM, getOptLevel()), PMW);
 
   derived().addIRPasses(PMW);
   derived().addCodeGenPrepare(PMW);
diff --git a/llvm/lib/CodeGen/CMakeLists.txt b/llvm/lib/CodeGen/CMakeLists.txt
index 8c9b172c0da65..871934ea4b76e 100644
--- a/llvm/lib/CodeGen/CMakeLists.txt
+++ b/llvm/lib/CodeGen/CMakeLists.txt
@@ -57,7 +57,7 @@ add_llvm_component_library(LLVMCodeGen
   EdgeBundles.cpp
   EHContGuardTargets.cpp
   ExecutionDomainFix.cpp
-  ExpandFp.cpp
+  ExpandIRInsts.cpp
   ExpandMemCmp.cpp
   ExpandPostRAPseudos.cpp
   ExpandReductions.cpp
diff --git a/llvm/lib/CodeGen/CodeGen.cpp b/llvm/lib/CodeGen/CodeGen.cpp
index 47633f89b70e9..3550eea13979a 100644
--- a/llvm/lib/CodeGen/CodeGen.cpp
+++ b/llvm/lib/CodeGen/CodeGen.cpp
@@ -39,7 +39,7 @@ void llvm::initializeCodeGen(PassRegistry &Registry) {
   initializeEarlyIfPredicatorPass(Registry);
   initializeEarlyMachineLICMPass(Registry);
   initializeEarlyTailDuplicateLegacyPass(Registry);
-  initializeExpandFpLegacyPassPass(Registry);
+  initializeExpandIRInstsLegacyPassPass(Registry);
   initializeExpandMemCmpLegacyPassPass(Registry);
   initializeExpandPostRALegacyPass(Registry);
   initializeFEntryInserterLegacyPass(Registry);
diff --git a/llvm/lib/CodeGen/ExpandFp.cpp b/llvm/lib/CodeGen/ExpandIRInsts.cpp
similarity index 95%
rename from llvm/lib/CodeGen/ExpandFp.cpp
rename to llvm/lib/CodeGen/ExpandIRInsts.cpp
index 395fef19a13b9..1d09000fbca6b 100644
--- a/llvm/lib/CodeGen/ExpandFp.cpp
+++ b/llvm/lib/CodeGen/ExpandIRInsts.cpp
@@ -1,26 +1,33 @@
-//===--- ExpandFp.cpp - Expand fp instructions ----------------------------===//
+//===--- ExpandIRInsts.cpp - Expand IR instructions -----------------------===//
 //
 // 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
 //
 //===----------------------------------------------------------------------===//
-// This pass expands certain floating point instructions at the IR level.
+// This pass expands certain instructions at the IR level.
 //
-// It expands ‘fptoui .. to’, ‘fptosi .. to’, ‘uitofp ..  to’, ‘sitofp
+// The following expansions are implemented:
+// - Expansion of ‘fptoui .. to’, ‘fptosi .. to’, ‘uitofp ..  to’, ‘sitofp
 // .. to’ instructions with a bitwidth above a threshold.  This is
 // useful for targets like x86_64 that cannot lower fp convertions
 // with more than 128 bits.
 //
-// This pass also expands div/rem instructions with a bitwidth above a
-// threshold into a call to auto-generated functions.  This is useful
-// for targets like x86_64 that cannot lower divisions with more than
-// 128 bits or targets like x86_32 that cannot lower divisions with
-// more than 64 bits.
+// - Expansion of ‘frem‘ for types MVT::f16, MVT::f32, and MVT::f64 for
+// targets which use "Expand" as the legalization action for the
+// corresponding type.
 //
+// - Expansion of ‘udiv‘, ‘sdiv‘, ‘urem‘, and ‘srem‘ instructions with
+// a bitwidth above a threshold into a call to auto-generated
+// functions.  This is useful for targets like x86_64 that cannot
+// lower divisions with more than 128 bits or targets like x86_32 that
+// cannot lower divisions with more than 64 bits.
+//
+// Instructions with vector types are scalarized first if their scalar
+// types can be expanded. Scalable vector types are not supported.
 //===----------------------------------------------------------------------===//
 
-#include "llvm/CodeGen/ExpandFp.h"
+#include "llvm/CodeGen/ExpandIRInsts.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Analysis/AssumptionCache.h"
 #include "llvm/Analysis/GlobalsModRef.h"
@@ -45,7 +52,7 @@
 #include <llvm/Support/Casting.h>
 #include <optional>
 
-#define DEBUG_TYPE "expand-fp"
+#define DEBUG_TYPE "expand-ir-insts"
 
 using namespace llvm;
 
@@ -1125,18 +1132,18 @@ static bool runImpl(Function &F, const TargetLowering &TLI,
 }
 
 namespace {
-class ExpandFpLegacyPass : public FunctionPass {
+class ExpandIRInstsLegacyPass : public FunctionPass {
   CodeGenOptLevel OptLevel;
 
 public:
   static char ID;
 
-  ExpandFpLegacyPass(CodeGenOptLevel OptLevel)
+  ExpandIRInstsLegacyPass(CodeGenOptLevel OptLevel)
       : FunctionPass(ID), OptLevel(OptLevel) {
-    initializeExpandFpLegacyPassPass(*PassRegistry::getPassRegistry());
+    initializeExpandIRInstsLegacyPassPass(*PassRegistry::getPassRegistry());
   }
 
-  ExpandFpLegacyPass() : ExpandFpLegacyPass(CodeGenOptLevel::None) {};
+  ExpandIRInstsLegacyPass() : ExpandIRInstsLegacyPass(CodeGenOptLevel::None) {};
 
   bool runOnFunction(Function &F) override {
     auto *TM = &getAnalysis<TargetPassConfig>().getTM<TargetMachine>();
@@ -1165,19 +1172,21 @@ class ExpandFpLegacyPass : public FunctionPass {
 };
 } // namespace
 
-ExpandFpPass::ExpandFpPass(const TargetMachine &TM, CodeGenOptLevel OptLevel)
+ExpandIRInstsPass::ExpandIRInstsPass(const TargetMachine &TM,
+                                     CodeGenOptLevel OptLevel)
     : TM(&TM), OptLevel(OptLevel) {}
 
-void ExpandFpPass::printPipeline(
+void ExpandIRInstsPass::printPipeline(
     raw_ostream &OS, function_ref<StringRef(StringRef)> MapClassName2PassName) {
-  static_cast<PassInfoMixin<ExpandFpPass> *>(this)->printPipeline(
+  static_cast<PassInfoMixin<ExpandIRInstsPass> *>(this)->printPipeline(
       OS, MapClassName2PassName);
   OS << '<';
   OS << "O" << (int)OptLevel;
   OS << '>';
 }
 
-PreservedAnalyses ExpandFpPass::run(Function &F, FunctionAnalysisManager &FAM) {
+PreservedAnalyses ExpandIRInstsPass::run(Function &F,
+                                         FunctionAnalysisManager &FAM) {
   const TargetSubtargetInfo *STI = TM->getSubtargetImpl(F);
   auto &TLI = *STI->getTargetLowering();
   AssumptionCache *AC = nullptr;
@@ -1202,12 +1211,13 @@ PreservedAnalyses ExpandFpPass::run(Function &F, FunctionAnalysisManager &FAM) {
                                        : PreservedAnalyses::all();
 }
 
-char ExpandFpLegacyPass::ID = 0;
-INITIALIZE_PASS_BEGIN(ExpandFpLegacyPass, "expand-fp",
+char ExpandIRInstsLegacyPass::ID = 0;
+INITIALIZE_PASS_BEGIN(ExpandIRInstsLegacyPass, "expand-ir-insts",
                       "Expand certain fp instructions", false, false)
 INITIALIZE_PASS_DEPENDENCY(LibcallLoweringInfoWrapper)
-INITIALIZE_PASS_END(ExpandFpLegacyPass, "expand-fp", "Expand fp", false, false)
+INITIALIZE_PASS_END(ExpandIRInstsLegacyPass, "expand-ir-insts",
+                    "Expand IR instructions", false, false)
 
-FunctionPass *llvm::createExpandFpPass(CodeGenOptLevel OptLevel) {
-  return new ExpandFpLegacyPass(OptLevel);
+FunctionPass *llvm::createExpandIRInstsPass(CodeGenOptLevel OptLevel) {
+  return new ExpandIRInstsLegacyPass(OptLevel);
 }
diff --git a/llvm/lib/CodeGen/TargetPassConfig.cpp b/llvm/lib/CodeGen/TargetPassConfig.cpp
index acceb66468409..ca75d3b47cf3a 100644
--- a/llvm/lib/CodeGen/TargetPassConfig.cpp
+++ b/llvm/lib/CodeGen/TargetPassConfig.cpp
@@ -1090,7 +1090,7 @@ bool TargetPassConfig::addISelPasses() {
 
   PM->add(createTargetTransformInfoWrapperPass(TM->getTargetIRAnalysis()));
   addPass(createPreISelIntrinsicLoweringPass());
-  addPass(createExpandFpPass(getOptLevel()));
+  addPass(createExpandIRInstsPass(getOptLevel()));
   addIRPasses();
   addCodeGenPrepare();
   addPassesToHandleExceptions();
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index d639c24664ad1..84ee043b5da56 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -91,7 +91,7 @@
 #include "llvm/CodeGen/DwarfEHPrepare.h"
 #include "llvm/CodeGen/EarlyIfConversion.h"
 #include "llvm/CodeGen/EdgeBundles.h"
-#include "llvm/CodeGen/ExpandFp.h"
+#include "llvm/CodeGen/ExpandIRInsts.h"
 #include "llvm/CodeGen/ExpandMemCmp.h"
 #include "llvm/CodeGen/ExpandPostRAPseudos.h"
 #include "llvm/CodeGen/ExpandReductions.h"
@@ -1632,7 +1632,7 @@ parseBoundsCheckingOptions(StringRef Params) {
   return Options;
 }
 
-Expected<CodeGenOptLevel> parseExpandFpOptions(StringRef Param) {
+Expected<CodeGenOptLevel> parseExpandIRInstsOptions(StringRef Param) {
   if (Param.empty())
     return CodeGenOptLevel::None;
 
@@ -1641,13 +1641,13 @@ Expected<CodeGenOptLevel> parseExpandFpOptions(StringRef Param) {
 
   uint8_t N;
   if (!Prefix.empty() || Digit.getAsInteger(10, N))
-    return createStringError("invalid expand-fp pass parameter '%s'",
+    return createStringError("invalid expand-ir-insts pass parameter '%s'",
                              Param.str().c_str());
 
   std::optional<CodeGenOptLevel> Level = CodeGenOpt::getLevel(N);
   if (!Level.has_value())
     return createStringError(
-        "invalid optimization level for expand-fp pass: %s",
+        "invalid optimization level for expand-ir-insts pass: %s",
         Digit.str().c_str());
 
   return *Level;
diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def
index 14215bb32e777..daf6b3d6dbd28 100644
--- a/llvm/lib/Passes/PassRegistry.def
+++ b/llvm/lib/Passes/PassRegistry.def
@@ -729,11 +729,11 @@ FUNCTION_PASS_WITH_PARAMS(
     parseBoundsCheckingOptions,
     "trap;rt;rt-abort;min-rt;min-rt-abort;merge;guard=N")
 FUNCTION_PASS_WITH_PARAMS(
-    "expand-fp", "ExpandFpPass",
+    "expand-ir-insts", "ExpandIRInstsPass",
     [TM = TM](CodeGenOptLevel OL) {
-      return ExpandFpPass(*TM, OL);
+      return ExpandIRInstsPass(*TM, OL);
     },
-    parseExpandFpOptions, "O0;O1;O2;O3")
+    parseExpandIRInstsOptions, "O0;O1;O2;O3")
 
 #undef FUNCTION_PASS_WITH_PARAMS
 
diff --git a/llvm/test/CodeGen/AArch64/O0-pipeline.ll b/llvm/test/CodeGen/AArch64/O0-pipeline.ll
index 2a1264446c70d..f4f9d38336608 100644
--- a/llvm/test/CodeGen/AArch64/O0-pipeline.ll
+++ b/llvm/test/CodeGen/AArch64/O0-pipeline.ll
@@ -17,7 +17,7 @@
 ; CHECK-NEXT:   ModulePass Manager
 ; CHECK-NEXT:     Pre-ISel Intrinsic Lowering
 ; CHECK-NEXT:     FunctionPass Manager
-; CHECK-NEXT:       Expand fp
+; CHECK-NEXT:       Expand IR instructions
 ; CHECK-NEXT:       Expand Atomic instructions
 ; CHECK-NEXT:       Module Verifier
 ; CHECK-NEXT:       Lower Garbage Collection Instructions
diff --git a/llvm/test/CodeGen/AArch64/O3-pipeline.ll b/llvm/test/CodeGen/AArch64/O3-pipeline.ll
index 4dc3cd1d6b786..f6ed7d5eed814 100644
--- a/llvm/test/CodeGen/AArch64/O3-pipeline.ll
+++ b/llvm/test/CodeGen/AArch64/O3-pipeline.ll
@@ -21,7 +21,7 @@
 ; CHECK-NEXT:   ModulePass Manager
 ; CHECK-NEXT:     Pre-ISel Intrinsic Lowering
 ; CHECK-NEXT:     FunctionPass Manager
-; CHECK-NEXT:       Expand fp
+; CHECK-NEXT:       Expand IR instructions
 ; CHECK-NEXT:       Expand Atomic instructions
 ; CHECK-NEXT:     SVE intrinsics optimizations
 ; CHECK-NEXT:       FunctionPass Manager
diff --git a/llvm/test/CodeGen/AMDGPU/dagcombine-select.ll b/llvm/test/CodeGen/AMDGPU/dagcombine-select.ll
index 39365fe7b6f15..c828f0b538bec 100644
--- a/llvm/test/CodeGen/AMDGPU/dagcombine-select.ll
+++ b/llvm/test/CodeGen/AMDGPU/dagcombine-select.ll
@@ -579,8 +579,8 @@ define amdgpu_kernel void @fdiv_constant_sel_constants(ptr addrspace(1) %p, i1 %
   ret void
 }
 
-; ExpandFp now expands frem before it reaches dagcombine.
-; TODO Implement this optimization in/before ExpandFP
+; ExpandIRInsts now expands frem before it reaches dagcombine.
+; TODO Implement this optimization in/before ExpandIRInsts?
 define amdgpu_kernel void @frem_constant_sel_constants(ptr addrspace(1) %p, i1 %cond) {
 ; GFX9-LABEL: frem_constant_sel_constants:
 ; GFX9:       ; %bb.0:
diff --git a/llvm/test/CodeGen/AMDGPU/itofp.i128.bf.ll b/llvm/test/CodeGen/AMDGPU/itofp.i128.bf.ll
index c001df48499c7..eee3352fa7452 100644
--- a/llvm/test/CodeGen/AMDGPU/itofp.i128.bf.ll
+++ b/llvm/test/CodeGen/AMDGPU/itofp.i128.bf.ll
@@ -2,7 +2,7 @@
 ; RUN: llc -global-isel=0 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 < %s | FileCheck -check-prefixes=GCN,SDAG %s
 ; RUN: not --crash llc -global-isel=1 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 < %s 2>&1 | FileCheck -check-prefix=GISEL %s
 
-; FIXME: GISEL can't handle the "fptrunc float to bfloat" that expand-fp emits.
+; FIXME: GISEL can't handle the "fptrunc float to bfloat" that expand-ir-insts emits.
 
 ; GISEL: unable to translate instruction: fptrunc
 
diff --git a/llvm/test/CodeGen/AMDGPU/llc-pipeline-npm.ll b/llvm/test/CodeGen/AMDGPU/llc-pipeline-npm.ll
index edf4b6f26d08e..61c751a9816a2 100644
--- a/llvm/test/CodeGen/AMDGPU/llc-pipeline-npm.ll
+++ b/llvm/test/CodeGen/AMDGPU/llc-pipeline-npm.ll
@@ -9,11 +9,11 @@
 ; RUN:   | FileCheck -check-prefix=GCN-O3 %s
 
 
-; GCN-O0: require<MachineModuleAnalysis>,require<profile-summary>,require<collector-metadata>,require<runtime-libcall-info>,pre-isel-intrinsic-lowering,function(expand-fp<O0>),amdgpu-remove-incompatible-functions,amdgpu-printf-runtime-binding,amdgpu-lower-ctor-dtor,function(amdgpu-uniform-intrinsic-combine),expand-variadics,amdgpu-always-inline,always-inline,amdgpu-export-kernel-runtime-handles,amdgpu-lower-exec-sync,amdgpu-sw-lower-lds,amdgpu-lower-module-lds,function(atomic-expand,verify,gc-lowering,lower-constant-intrinsics,unreachableblockelim,ee-instrument<post-inline>,scalarize-masked-mem-intrin,expand-reductions,amdgpu-lower-kernel-arguments),amdgpu-lower-buffer-fat-pointers,amdgpu-lower-intrinsics,cgscc(function(lower-switch,lower-invoke,unreachableblockelim)),require<amdgpu-argument-usage>,cgscc(function(amdgp...
[truncated]

@llvmbot

llvmbot commented Dec 17, 2025

Copy link
Copy Markdown
Member

@llvm/pr-subscribers-backend-loongarch

Author: Frederik Harwath (frederik-h)

Changes

The pass now contains a non-fp expansion and should
be used for any similar expansions regardless of the
types involved. Hence a generic name seems apt.

Rename the source files, pass, and adjust the pass
description. Move all tests for the expansions
that have previously been merged into the pass
to a single directory.


Patch is 67.80 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/172681.diff

52 Files Affected:

  • (modified) llvm/docs/WritingAnLLVMPass.rst (+1-1)
  • (renamed) llvm/include/llvm/CodeGen/ExpandIRInsts.h (+6-6)
  • (modified) llvm/include/llvm/CodeGen/Passes.h (+2-2)
  • (modified) llvm/include/llvm/CodeGen/TargetLowering.h (+6-6)
  • (modified) llvm/include/llvm/InitializePasses.h (+1-1)
  • (modified) llvm/include/llvm/Passes/CodeGenPassBuilder.h (+2-2)
  • (modified) llvm/lib/CodeGen/CMakeLists.txt (+1-1)
  • (modified) llvm/lib/CodeGen/CodeGen.cpp (+1-1)
  • (renamed) llvm/lib/CodeGen/ExpandIRInsts.cpp (+33-23)
  • (modified) llvm/lib/CodeGen/TargetPassConfig.cpp (+1-1)
  • (modified) llvm/lib/Passes/PassBuilder.cpp (+4-4)
  • (modified) llvm/lib/Passes/PassRegistry.def (+3-3)
  • (modified) llvm/test/CodeGen/AArch64/O0-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/AArch64/O3-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/AMDGPU/dagcombine-select.ll (+2-2)
  • (modified) llvm/test/CodeGen/AMDGPU/itofp.i128.bf.ll (+1-1)
  • (modified) llvm/test/CodeGen/AMDGPU/llc-pipeline-npm.ll (+3-3)
  • (modified) llvm/test/CodeGen/AMDGPU/llc-pipeline.ll (+5-5)
  • (modified) llvm/test/CodeGen/ARM/O3-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/LoongArch/O0-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/LoongArch/opt-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/M68k/pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/PowerPC/O0-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/PowerPC/O3-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/RISCV/O0-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/RISCV/O3-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/SPIRV/llc-pipeline.ll (+2-2)
  • (modified) llvm/test/CodeGen/X86/O0-pipeline.ll (+1-1)
  • (modified) llvm/test/CodeGen/X86/expand-large-fp-optnone.ll (+1-1)
  • (modified) llvm/test/CodeGen/X86/opt-pipeline.ll (+1-1)
  • (removed) llvm/test/Transforms/ExpandFp/AMDGPU/pass-parameters.ll (-20)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/AMDGPU/frem-inf.ll (+2-2)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/AMDGPU/frem.ll (+1-1)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/AMDGPU/lit.local.cfg ()
  • (renamed) llvm/test/Transforms/ExpandIRInsts/AMDGPU/missing-analysis.ll (+1-1)
  • (added) llvm/test/Transforms/ExpandIRInsts/AMDGPU/pass-parameters.ll (+20)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-convert-fptosi129.ll (+2-2)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-convert-fptoui129.ll (+2-2)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-convert-si129tofp.ll (+2-2)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-convert-ui129tofp.ll (+2-2)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/expand-large-fp-optnone.ll (+3-3)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/lit.local.cfg ()
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/sdiv129.ll (+2-2)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/srem129.ll (+2-2)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/udiv129.ll (+2-2)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/urem129.ll (+2-2)
  • (renamed) llvm/test/Transforms/ExpandIRInsts/X86/vector.ll (+2-2)
  • (removed) llvm/test/Transforms/ExpandLargeFpConvert/X86/lit.local.cfg (-2)
  • (modified) llvm/test/tools/opt/no-target-machine.ll (+2-2)
  • (modified) llvm/tools/opt/optdriver.cpp (+2-2)
  • (modified) llvm/utils/gn/secondary/llvm/lib/CodeGen/BUILD.gn (+1-1)
  • (modified) llvm/utils/profcheck-xfail.txt (+9-9)
diff --git a/llvm/docs/WritingAnLLVMPass.rst b/llvm/docs/WritingAnLLVMPass.rst
index f475676e15367..216e693087d96 100644
--- a/llvm/docs/WritingAnLLVMPass.rst
+++ b/llvm/docs/WritingAnLLVMPass.rst
@@ -673,7 +673,7 @@ default optimization pipelines, e.g. (the output has been trimmed):
   ModulePass Manager
   Pre-ISel Intrinsic Lowering
   FunctionPass Manager
-    Expand fp
+    Expand IR instructions
     Expand Atomic instructions
   SVE intrinsics optimizations
     FunctionPass Manager
diff --git a/llvm/include/llvm/CodeGen/ExpandFp.h b/llvm/include/llvm/CodeGen/ExpandIRInsts.h
similarity index 68%
rename from llvm/include/llvm/CodeGen/ExpandFp.h
rename to llvm/include/llvm/CodeGen/ExpandIRInsts.h
index 28e6aecc2beb5..5d3fcf75cd530 100644
--- a/llvm/include/llvm/CodeGen/ExpandFp.h
+++ b/llvm/include/llvm/CodeGen/ExpandIRInsts.h
@@ -1,4 +1,4 @@
-//===- ExpandFp.h -----------------------------------*- C++ -*-===//
+//===- ExpandIRInsts.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.
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CODEGEN_EXPANDFP_H
-#define LLVM_CODEGEN_EXPANDFP_H
+#ifndef LLVM_CODEGEN_EXPANDIRINSTS_H
+#define LLVM_CODEGEN_EXPANDIRINSTS_H
 
 #include "llvm/IR/PassManager.h"
 #include "llvm/Support/CodeGen.h"
@@ -16,13 +16,13 @@ namespace llvm {
 
 class TargetMachine;
 
-class ExpandFpPass : public PassInfoMixin<ExpandFpPass> {
+class ExpandIRInstsPass : public PassInfoMixin<ExpandIRInstsPass> {
 private:
   const TargetMachine *TM;
   CodeGenOptLevel OptLevel;
 
 public:
-  explicit ExpandFpPass(const TargetMachine &TM, CodeGenOptLevel OptLevel);
+  explicit ExpandIRInstsPass(const TargetMachine &TM, CodeGenOptLevel OptLevel);
 
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
   static bool isRequired() { return true; }
@@ -32,4 +32,4 @@ class ExpandFpPass : public PassInfoMixin<ExpandFpPass> {
 
 } // end namespace llvm
 
-#endif // LLVM_CODEGEN_EXPANDFP_H
+#endif // LLVM_CODEGEN_EXPANDIRINSTS_H
diff --git a/llvm/include/llvm/CodeGen/Passes.h b/llvm/include/llvm/CodeGen/Passes.h
index 08dabd69a48e9..fe19e6a32c680 100644
--- a/llvm/include/llvm/CodeGen/Passes.h
+++ b/llvm/include/llvm/CodeGen/Passes.h
@@ -547,7 +547,7 @@ LLVM_ABI FunctionPass *createExpandReductionsPass();
 LLVM_ABI FunctionPass *createReplaceWithVeclibLegacyPass();
 
 // Expands large div/rem instructions.
-LLVM_ABI FunctionPass *createExpandFpPass();
+LLVM_ABI FunctionPass *createExpandIRInstsPass();
 
 // This pass expands memcmp() to load/stores.
 LLVM_ABI FunctionPass *createExpandMemCmpLegacyPass();
@@ -565,7 +565,7 @@ LLVM_ABI FunctionPass *createCFIFixup();
 LLVM_ABI FunctionPass *createCFIInstrInserter();
 
 // Expands floating point instructions.
-FunctionPass *createExpandFpPass(CodeGenOptLevel);
+FunctionPass *createExpandIRInstsPass(CodeGenOptLevel);
 
 /// Creates CFGuard longjmp target identification pass.
 /// \see CFGuardLongjmp.cpp
diff --git a/llvm/include/llvm/CodeGen/TargetLowering.h b/llvm/include/llvm/CodeGen/TargetLowering.h
index 06bc5caefd063..8ad64a852b74d 100644
--- a/llvm/include/llvm/CodeGen/TargetLowering.h
+++ b/llvm/include/llvm/CodeGen/TargetLowering.h
@@ -2220,13 +2220,13 @@ class LLVM_ABI TargetLoweringBase {
   }
 
   /// Returns the size in bits of the maximum div/rem the backend supports.
-  /// Larger operations will be expanded by ExpandFp.
+  /// Larger operations will be expanded by ExpandIRInsts.
   unsigned getMaxDivRemBitWidthSupported() const {
     return MaxDivRemBitWidthSupported;
   }
 
   /// Returns the size in bits of the maximum fp to/from int conversion the
-  /// backend supports. Larger operations will be expanded by ExpandFp.
+  /// backend supports. Larger operations will be expanded by ExpandIRInsts.
   unsigned getMaxLargeFPConvertBitWidthSupported() const {
     return MaxLargeFPConvertBitWidthSupported;
   }
@@ -2886,13 +2886,13 @@ class LLVM_ABI TargetLoweringBase {
   }
 
   /// Set the size in bits of the maximum div/rem the backend supports.
-  /// Larger operations will be expanded by ExpandFp.
+  /// Larger operations will be expanded by ExpandIRInsts.
   void setMaxDivRemBitWidthSupported(unsigned SizeInBits) {
     MaxDivRemBitWidthSupported = SizeInBits;
   }
 
   /// Set the size in bits of the maximum fp to/from int conversion the backend
-  /// supports. Larger operations will be expanded by ExpandFp.
+  /// supports. Larger operations will be expanded by ExpandIRInsts.
   void setMaxLargeFPConvertBitWidthSupported(unsigned SizeInBits) {
     MaxLargeFPConvertBitWidthSupported = SizeInBits;
   }
@@ -3743,12 +3743,12 @@ class LLVM_ABI TargetLoweringBase {
   unsigned MaxAtomicSizeInBitsSupported;
 
   /// Size in bits of the maximum div/rem size the backend supports.
-  /// Larger operations will be expanded by ExpandFp.
+  /// Larger operations will be expanded by ExpandIRInsts.
   unsigned MaxDivRemBitWidthSupported;
 
   /// Size in bits of the maximum fp to/from int conversion size the
   /// backend supports. Larger operations will be expanded by
-  /// ExpandFp.
+  /// ExpandIRInsts.
   unsigned MaxLargeFPConvertBitWidthSupported;
 
   /// Size in bits of the minimum cmpxchg or ll/sc operation the
diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h
index b4f96674bea9e..2bc00a2f71e1a 100644
--- a/llvm/include/llvm/InitializePasses.h
+++ b/llvm/include/llvm/InitializePasses.h
@@ -112,7 +112,7 @@ LLVM_ABI void initializeEarlyMachineLICMPass(PassRegistry &);
 LLVM_ABI void initializeEarlyTailDuplicateLegacyPass(PassRegistry &);
 LLVM_ABI void initializeEdgeBundlesWrapperLegacyPass(PassRegistry &);
 LLVM_ABI void initializeEHContGuardTargetsPass(PassRegistry &);
-LLVM_ABI void initializeExpandFpLegacyPassPass(PassRegistry &);
+LLVM_ABI void initializeExpandIRInstsLegacyPassPass(PassRegistry &);
 LLVM_ABI void initializeExpandMemCmpLegacyPassPass(PassRegistry &);
 LLVM_ABI void initializeExpandPostRALegacyPass(PassRegistry &);
 LLVM_ABI void initializeExpandReductionsPass(PassRegistry &);
diff --git a/llvm/include/llvm/Passes/CodeGenPassBuilder.h b/llvm/include/llvm/Passes/CodeGenPassBuilder.h
index 0462adb835d89..9bf8e1976fad8 100644
--- a/llvm/include/llvm/Passes/CodeGenPassBuilder.h
+++ b/llvm/include/llvm/Passes/CodeGenPassBuilder.h
@@ -32,7 +32,7 @@
 #include "llvm/CodeGen/DetectDeadLanes.h"
 #include "llvm/CodeGen/DwarfEHPrepare.h"
 #include "llvm/CodeGen/EarlyIfConversion.h"
-#include "llvm/CodeGen/ExpandFp.h"
+#include "llvm/CodeGen/ExpandIRInsts.h"
 #include "llvm/CodeGen/ExpandMemCmp.h"
 #include "llvm/CodeGen/ExpandPostRAPseudos.h"
 #include "llvm/CodeGen/ExpandReductions.h"
@@ -677,7 +677,7 @@ void CodeGenPassBuilder<Derived, TargetMachineT>::addISelPasses(
     addModulePass(LowerEmuTLSPass(), PMW);
 
   addModulePass(PreISelIntrinsicLoweringPass(&TM), PMW);
-  addFunctionPass(ExpandFpPass(TM, getOptLevel()), PMW);
+  addFunctionPass(ExpandIRInstsPass(TM, getOptLevel()), PMW);
 
   derived().addIRPasses(PMW);
   derived().addCodeGenPrepare(PMW);
diff --git a/llvm/lib/CodeGen/CMakeLists.txt b/llvm/lib/CodeGen/CMakeLists.txt
index 8c9b172c0da65..871934ea4b76e 100644
--- a/llvm/lib/CodeGen/CMakeLists.txt
+++ b/llvm/lib/CodeGen/CMakeLists.txt
@@ -57,7 +57,7 @@ add_llvm_component_library(LLVMCodeGen
   EdgeBundles.cpp
   EHContGuardTargets.cpp
   ExecutionDomainFix.cpp
-  ExpandFp.cpp
+  ExpandIRInsts.cpp
   ExpandMemCmp.cpp
   ExpandPostRAPseudos.cpp
   ExpandReductions.cpp
diff --git a/llvm/lib/CodeGen/CodeGen.cpp b/llvm/lib/CodeGen/CodeGen.cpp
index 47633f89b70e9..3550eea13979a 100644
--- a/llvm/lib/CodeGen/CodeGen.cpp
+++ b/llvm/lib/CodeGen/CodeGen.cpp
@@ -39,7 +39,7 @@ void llvm::initializeCodeGen(PassRegistry &Registry) {
   initializeEarlyIfPredicatorPass(Registry);
   initializeEarlyMachineLICMPass(Registry);
   initializeEarlyTailDuplicateLegacyPass(Registry);
-  initializeExpandFpLegacyPassPass(Registry);
+  initializeExpandIRInstsLegacyPassPass(Registry);
   initializeExpandMemCmpLegacyPassPass(Registry);
   initializeExpandPostRALegacyPass(Registry);
   initializeFEntryInserterLegacyPass(Registry);
diff --git a/llvm/lib/CodeGen/ExpandFp.cpp b/llvm/lib/CodeGen/ExpandIRInsts.cpp
similarity index 95%
rename from llvm/lib/CodeGen/ExpandFp.cpp
rename to llvm/lib/CodeGen/ExpandIRInsts.cpp
index 395fef19a13b9..1d09000fbca6b 100644
--- a/llvm/lib/CodeGen/ExpandFp.cpp
+++ b/llvm/lib/CodeGen/ExpandIRInsts.cpp
@@ -1,26 +1,33 @@
-//===--- ExpandFp.cpp - Expand fp instructions ----------------------------===//
+//===--- ExpandIRInsts.cpp - Expand IR instructions -----------------------===//
 //
 // 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
 //
 //===----------------------------------------------------------------------===//
-// This pass expands certain floating point instructions at the IR level.
+// This pass expands certain instructions at the IR level.
 //
-// It expands ‘fptoui .. to’, ‘fptosi .. to’, ‘uitofp ..  to’, ‘sitofp
+// The following expansions are implemented:
+// - Expansion of ‘fptoui .. to’, ‘fptosi .. to’, ‘uitofp ..  to’, ‘sitofp
 // .. to’ instructions with a bitwidth above a threshold.  This is
 // useful for targets like x86_64 that cannot lower fp convertions
 // with more than 128 bits.
 //
-// This pass also expands div/rem instructions with a bitwidth above a
-// threshold into a call to auto-generated functions.  This is useful
-// for targets like x86_64 that cannot lower divisions with more than
-// 128 bits or targets like x86_32 that cannot lower divisions with
-// more than 64 bits.
+// - Expansion of ‘frem‘ for types MVT::f16, MVT::f32, and MVT::f64 for
+// targets which use "Expand" as the legalization action for the
+// corresponding type.
 //
+// - Expansion of ‘udiv‘, ‘sdiv‘, ‘urem‘, and ‘srem‘ instructions with
+// a bitwidth above a threshold into a call to auto-generated
+// functions.  This is useful for targets like x86_64 that cannot
+// lower divisions with more than 128 bits or targets like x86_32 that
+// cannot lower divisions with more than 64 bits.
+//
+// Instructions with vector types are scalarized first if their scalar
+// types can be expanded. Scalable vector types are not supported.
 //===----------------------------------------------------------------------===//
 
-#include "llvm/CodeGen/ExpandFp.h"
+#include "llvm/CodeGen/ExpandIRInsts.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Analysis/AssumptionCache.h"
 #include "llvm/Analysis/GlobalsModRef.h"
@@ -45,7 +52,7 @@
 #include <llvm/Support/Casting.h>
 #include <optional>
 
-#define DEBUG_TYPE "expand-fp"
+#define DEBUG_TYPE "expand-ir-insts"
 
 using namespace llvm;
 
@@ -1125,18 +1132,18 @@ static bool runImpl(Function &F, const TargetLowering &TLI,
 }
 
 namespace {
-class ExpandFpLegacyPass : public FunctionPass {
+class ExpandIRInstsLegacyPass : public FunctionPass {
   CodeGenOptLevel OptLevel;
 
 public:
   static char ID;
 
-  ExpandFpLegacyPass(CodeGenOptLevel OptLevel)
+  ExpandIRInstsLegacyPass(CodeGenOptLevel OptLevel)
       : FunctionPass(ID), OptLevel(OptLevel) {
-    initializeExpandFpLegacyPassPass(*PassRegistry::getPassRegistry());
+    initializeExpandIRInstsLegacyPassPass(*PassRegistry::getPassRegistry());
   }
 
-  ExpandFpLegacyPass() : ExpandFpLegacyPass(CodeGenOptLevel::None) {};
+  ExpandIRInstsLegacyPass() : ExpandIRInstsLegacyPass(CodeGenOptLevel::None) {};
 
   bool runOnFunction(Function &F) override {
     auto *TM = &getAnalysis<TargetPassConfig>().getTM<TargetMachine>();
@@ -1165,19 +1172,21 @@ class ExpandFpLegacyPass : public FunctionPass {
 };
 } // namespace
 
-ExpandFpPass::ExpandFpPass(const TargetMachine &TM, CodeGenOptLevel OptLevel)
+ExpandIRInstsPass::ExpandIRInstsPass(const TargetMachine &TM,
+                                     CodeGenOptLevel OptLevel)
     : TM(&TM), OptLevel(OptLevel) {}
 
-void ExpandFpPass::printPipeline(
+void ExpandIRInstsPass::printPipeline(
     raw_ostream &OS, function_ref<StringRef(StringRef)> MapClassName2PassName) {
-  static_cast<PassInfoMixin<ExpandFpPass> *>(this)->printPipeline(
+  static_cast<PassInfoMixin<ExpandIRInstsPass> *>(this)->printPipeline(
       OS, MapClassName2PassName);
   OS << '<';
   OS << "O" << (int)OptLevel;
   OS << '>';
 }
 
-PreservedAnalyses ExpandFpPass::run(Function &F, FunctionAnalysisManager &FAM) {
+PreservedAnalyses ExpandIRInstsPass::run(Function &F,
+                                         FunctionAnalysisManager &FAM) {
   const TargetSubtargetInfo *STI = TM->getSubtargetImpl(F);
   auto &TLI = *STI->getTargetLowering();
   AssumptionCache *AC = nullptr;
@@ -1202,12 +1211,13 @@ PreservedAnalyses ExpandFpPass::run(Function &F, FunctionAnalysisManager &FAM) {
                                        : PreservedAnalyses::all();
 }
 
-char ExpandFpLegacyPass::ID = 0;
-INITIALIZE_PASS_BEGIN(ExpandFpLegacyPass, "expand-fp",
+char ExpandIRInstsLegacyPass::ID = 0;
+INITIALIZE_PASS_BEGIN(ExpandIRInstsLegacyPass, "expand-ir-insts",
                       "Expand certain fp instructions", false, false)
 INITIALIZE_PASS_DEPENDENCY(LibcallLoweringInfoWrapper)
-INITIALIZE_PASS_END(ExpandFpLegacyPass, "expand-fp", "Expand fp", false, false)
+INITIALIZE_PASS_END(ExpandIRInstsLegacyPass, "expand-ir-insts",
+                    "Expand IR instructions", false, false)
 
-FunctionPass *llvm::createExpandFpPass(CodeGenOptLevel OptLevel) {
-  return new ExpandFpLegacyPass(OptLevel);
+FunctionPass *llvm::createExpandIRInstsPass(CodeGenOptLevel OptLevel) {
+  return new ExpandIRInstsLegacyPass(OptLevel);
 }
diff --git a/llvm/lib/CodeGen/TargetPassConfig.cpp b/llvm/lib/CodeGen/TargetPassConfig.cpp
index acceb66468409..ca75d3b47cf3a 100644
--- a/llvm/lib/CodeGen/TargetPassConfig.cpp
+++ b/llvm/lib/CodeGen/TargetPassConfig.cpp
@@ -1090,7 +1090,7 @@ bool TargetPassConfig::addISelPasses() {
 
   PM->add(createTargetTransformInfoWrapperPass(TM->getTargetIRAnalysis()));
   addPass(createPreISelIntrinsicLoweringPass());
-  addPass(createExpandFpPass(getOptLevel()));
+  addPass(createExpandIRInstsPass(getOptLevel()));
   addIRPasses();
   addCodeGenPrepare();
   addPassesToHandleExceptions();
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index d639c24664ad1..84ee043b5da56 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -91,7 +91,7 @@
 #include "llvm/CodeGen/DwarfEHPrepare.h"
 #include "llvm/CodeGen/EarlyIfConversion.h"
 #include "llvm/CodeGen/EdgeBundles.h"
-#include "llvm/CodeGen/ExpandFp.h"
+#include "llvm/CodeGen/ExpandIRInsts.h"
 #include "llvm/CodeGen/ExpandMemCmp.h"
 #include "llvm/CodeGen/ExpandPostRAPseudos.h"
 #include "llvm/CodeGen/ExpandReductions.h"
@@ -1632,7 +1632,7 @@ parseBoundsCheckingOptions(StringRef Params) {
   return Options;
 }
 
-Expected<CodeGenOptLevel> parseExpandFpOptions(StringRef Param) {
+Expected<CodeGenOptLevel> parseExpandIRInstsOptions(StringRef Param) {
   if (Param.empty())
     return CodeGenOptLevel::None;
 
@@ -1641,13 +1641,13 @@ Expected<CodeGenOptLevel> parseExpandFpOptions(StringRef Param) {
 
   uint8_t N;
   if (!Prefix.empty() || Digit.getAsInteger(10, N))
-    return createStringError("invalid expand-fp pass parameter '%s'",
+    return createStringError("invalid expand-ir-insts pass parameter '%s'",
                              Param.str().c_str());
 
   std::optional<CodeGenOptLevel> Level = CodeGenOpt::getLevel(N);
   if (!Level.has_value())
     return createStringError(
-        "invalid optimization level for expand-fp pass: %s",
+        "invalid optimization level for expand-ir-insts pass: %s",
         Digit.str().c_str());
 
   return *Level;
diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def
index 14215bb32e777..daf6b3d6dbd28 100644
--- a/llvm/lib/Passes/PassRegistry.def
+++ b/llvm/lib/Passes/PassRegistry.def
@@ -729,11 +729,11 @@ FUNCTION_PASS_WITH_PARAMS(
     parseBoundsCheckingOptions,
     "trap;rt;rt-abort;min-rt;min-rt-abort;merge;guard=N")
 FUNCTION_PASS_WITH_PARAMS(
-    "expand-fp", "ExpandFpPass",
+    "expand-ir-insts", "ExpandIRInstsPass",
     [TM = TM](CodeGenOptLevel OL) {
-      return ExpandFpPass(*TM, OL);
+      return ExpandIRInstsPass(*TM, OL);
     },
-    parseExpandFpOptions, "O0;O1;O2;O3")
+    parseExpandIRInstsOptions, "O0;O1;O2;O3")
 
 #undef FUNCTION_PASS_WITH_PARAMS
 
diff --git a/llvm/test/CodeGen/AArch64/O0-pipeline.ll b/llvm/test/CodeGen/AArch64/O0-pipeline.ll
index 2a1264446c70d..f4f9d38336608 100644
--- a/llvm/test/CodeGen/AArch64/O0-pipeline.ll
+++ b/llvm/test/CodeGen/AArch64/O0-pipeline.ll
@@ -17,7 +17,7 @@
 ; CHECK-NEXT:   ModulePass Manager
 ; CHECK-NEXT:     Pre-ISel Intrinsic Lowering
 ; CHECK-NEXT:     FunctionPass Manager
-; CHECK-NEXT:       Expand fp
+; CHECK-NEXT:       Expand IR instructions
 ; CHECK-NEXT:       Expand Atomic instructions
 ; CHECK-NEXT:       Module Verifier
 ; CHECK-NEXT:       Lower Garbage Collection Instructions
diff --git a/llvm/test/CodeGen/AArch64/O3-pipeline.ll b/llvm/test/CodeGen/AArch64/O3-pipeline.ll
index 4dc3cd1d6b786..f6ed7d5eed814 100644
--- a/llvm/test/CodeGen/AArch64/O3-pipeline.ll
+++ b/llvm/test/CodeGen/AArch64/O3-pipeline.ll
@@ -21,7 +21,7 @@
 ; CHECK-NEXT:   ModulePass Manager
 ; CHECK-NEXT:     Pre-ISel Intrinsic Lowering
 ; CHECK-NEXT:     FunctionPass Manager
-; CHECK-NEXT:       Expand fp
+; CHECK-NEXT:       Expand IR instructions
 ; CHECK-NEXT:       Expand Atomic instructions
 ; CHECK-NEXT:     SVE intrinsics optimizations
 ; CHECK-NEXT:       FunctionPass Manager
diff --git a/llvm/test/CodeGen/AMDGPU/dagcombine-select.ll b/llvm/test/CodeGen/AMDGPU/dagcombine-select.ll
index 39365fe7b6f15..c828f0b538bec 100644
--- a/llvm/test/CodeGen/AMDGPU/dagcombine-select.ll
+++ b/llvm/test/CodeGen/AMDGPU/dagcombine-select.ll
@@ -579,8 +579,8 @@ define amdgpu_kernel void @fdiv_constant_sel_constants(ptr addrspace(1) %p, i1 %
   ret void
 }
 
-; ExpandFp now expands frem before it reaches dagcombine.
-; TODO Implement this optimization in/before ExpandFP
+; ExpandIRInsts now expands frem before it reaches dagcombine.
+; TODO Implement this optimization in/before ExpandIRInsts?
 define amdgpu_kernel void @frem_constant_sel_constants(ptr addrspace(1) %p, i1 %cond) {
 ; GFX9-LABEL: frem_constant_sel_constants:
 ; GFX9:       ; %bb.0:
diff --git a/llvm/test/CodeGen/AMDGPU/itofp.i128.bf.ll b/llvm/test/CodeGen/AMDGPU/itofp.i128.bf.ll
index c001df48499c7..eee3352fa7452 100644
--- a/llvm/test/CodeGen/AMDGPU/itofp.i128.bf.ll
+++ b/llvm/test/CodeGen/AMDGPU/itofp.i128.bf.ll
@@ -2,7 +2,7 @@
 ; RUN: llc -global-isel=0 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 < %s | FileCheck -check-prefixes=GCN,SDAG %s
 ; RUN: not --crash llc -global-isel=1 -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 < %s 2>&1 | FileCheck -check-prefix=GISEL %s
 
-; FIXME: GISEL can't handle the "fptrunc float to bfloat" that expand-fp emits.
+; FIXME: GISEL can't handle the "fptrunc float to bfloat" that expand-ir-insts emits.
 
 ; GISEL: unable to translate instruction: fptrunc
 
diff --git a/llvm/test/CodeGen/AMDGPU/llc-pipeline-npm.ll b/llvm/test/CodeGen/AMDGPU/llc-pipeline-npm.ll
index edf4b6f26d08e..61c751a9816a2 100644
--- a/llvm/test/CodeGen/AMDGPU/llc-pipeline-npm.ll
+++ b/llvm/test/CodeGen/AMDGPU/llc-pipeline-npm.ll
@@ -9,11 +9,11 @@
 ; RUN:   | FileCheck -check-prefix=GCN-O3 %s
 
 
-; GCN-O0: require<MachineModuleAnalysis>,require<profile-summary>,require<collector-metadata>,require<runtime-libcall-info>,pre-isel-intrinsic-lowering,function(expand-fp<O0>),amdgpu-remove-incompatible-functions,amdgpu-printf-runtime-binding,amdgpu-lower-ctor-dtor,function(amdgpu-uniform-intrinsic-combine),expand-variadics,amdgpu-always-inline,always-inline,amdgpu-export-kernel-runtime-handles,amdgpu-lower-exec-sync,amdgpu-sw-lower-lds,amdgpu-lower-module-lds,function(atomic-expand,verify,gc-lowering,lower-constant-intrinsics,unreachableblockelim,ee-instrument<post-inline>,scalarize-masked-mem-intrin,expand-reductions,amdgpu-lower-kernel-arguments),amdgpu-lower-buffer-fat-pointers,amdgpu-lower-intrinsics,cgscc(function(lower-switch,lower-invoke,unreachableblockelim)),require<amdgpu-argument-usage>,cgscc(function(amdgp...
[truncated]

@arsenm arsenm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe should use the work legalize instead of expand but I suppose atomic is already atomic expand

frederik-h commented Dec 18, 2025 •

Copy link
Copy Markdown
Contributor Author

Merge activity

  • Dec 18, 7:42 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Dec 18, 8:23 AM UTC: Graphite rebased this pull request as part of a merge.
  • Dec 18, 8:57 AM UTC: Graphite rebased this pull request as part of a merge.
  • Dec 18, 9:02 AM UTC: Graphite rebased this pull request as part of a merge.
  • Dec 18, 9:15 AM UTC: Graphite rebased this pull request as part of a merge.
  • Dec 18, 9:19 AM UTC: Graphite rebased this pull request as part of a merge.
  • Dec 18, 9:22 AM UTC: Graphite rebased this pull request as part of a merge.
  • Dec 18, 9:26 AM UTC: Graphite rebased this pull request as part of a merge.
  • Dec 18, 9:31 AM UTC: Graphite rebased this pull request as part of a merge.
  • Dec 18, 9:36 AM UTC: Graphite rebased this pull request as part of a merge.
  • Dec 18, 9:48 AM UTC: Graphite rebased this pull request as part of a merge.
  • Dec 18, 9:49 AM UTC: Graphite rebased this pull request as part of a merge.
  • Dec 18, 9:58 AM UTC: Graphite rebased this pull request as part of a merge.
  • Dec 18, 10:01 AM UTC: Graphite rebased this pull request as part of a merge.
  • Dec 18, 10:03 AM UTC: Graphite rebased this pull request as part of a merge.
  • Dec 18, 10:09 AM UTC: Graphite rebased this pull request as part of a merge.
  • Dec 18, 10:14 AM UTC: Graphite rebased this pull request as part of a merge.
  • Dec 18, 10:30 AM UTC: Graphite rebased this pull request as part of a merge.
  • Dec 18, 10:36 AM UTC: Graphite rebased this pull request as part of a merge.

@frederik-h
frederik-h force-pushed the users/frederik-h/Rename_expand-fp_to_expand-ir-insts_to_better_reflect_its_functionality branch 13 times, most recently from 6a5d42f to c447a39 Compare December 18, 2025 10:30
The pass now contains a non-fp expansion and should
be used for any similar expansions regardless of the
types involved. Hence a generic name seems apt.

Rename the source files, pass, and adjust the pass
description. Move all tests for the expansions
that have previously been merged into the pass
to a single directory.
@frederik-h
frederik-h force-pushed the users/frederik-h/Rename_expand-fp_to_expand-ir-insts_to_better_reflect_its_functionality branch from c447a39 to 0d18ff1 Compare December 18, 2025 10:36
@arsenm

arsenm commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

The graphite merge button has been broken for months. It will continuously rebase and re-run CI if any commit has merged before it completes. You should abort this and hit the manual merge button.

@frederik-h

Copy link
Copy Markdown
Contributor Author

The graphite merge button has been broken for months. It will continuously rebase and re-run CI if any commit has merged before it completes. You should abort this and hit the manual merge button.

Thank you for the hint! I already started suspecting something must be wrong ;-). I just started using graphite.

@frederik-h
frederik-h enabled auto-merge (squash) December 18, 2025 11:07
@frederik-h
frederik-h merged commit 5c05824 into main Dec 18, 2025
@frederik-h
frederik-h deleted the users/frederik-h/Rename_expand-fp_to_expand-ir-insts_to_better_reflect_its_functionality branch December 18, 2025 11:15
@llvm-ci

llvm-ci commented Dec 18, 2025

Copy link
Copy Markdown

LLVM Buildbot has detected a new failure on builder reverse-iteration running on hexagon-build-03 while building llvm at step 6 "check_all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/110/builds/6873

Here is the relevant piece of the build log for the reference
Step 6 (check_all) failure: test (failure)
******************** TEST 'Clang :: Interpreter/cxx20-modules.cppm' FAILED ********************
Exit Code: 2

Command Output (stdout):
--
# RUN: at line 3
rm -rf /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp
# executed command: rm -rf /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp
# RUN: at line 4
mkdir -p /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp
# executed command: mkdir -p /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp
# RUN: at line 5
split-file /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.src/clang/test/Interpreter/cxx20-modules.cppm /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp
# executed command: split-file /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.src/clang/test/Interpreter/cxx20-modules.cppm /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp
# RUN: at line 7
/local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/bin/clang -std=c++20 /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp/mod.cppm --precompile      -o /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp/mod.pcm --target=x86_64-linux-gnu
# executed command: /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/bin/clang -std=c++20 /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp/mod.cppm --precompile -o /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp/mod.pcm --target=x86_64-linux-gnu
# RUN: at line 9
/local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/bin/clang -fPIC /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp/mod.pcm -c -o /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp/mod.o --target=x86_64-linux-gnu
# executed command: /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/bin/clang -fPIC /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp/mod.pcm -c -o /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp/mod.o --target=x86_64-linux-gnu
# RUN: at line 10
/local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/bin/clang -nostdlib -fPIC -shared /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp/mod.o -o /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp/libmod.so --target=x86_64-linux-gnu
# executed command: /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/bin/clang -nostdlib -fPIC -shared /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp/mod.o -o /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp/libmod.so --target=x86_64-linux-gnu
# RUN: at line 12
cat /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp/import.cpp | env LD_LIBRARY_PATH=/local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp:$LD_LIBRARY_PATH      /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/bin/clang-repl -Xcc=-std=c++20 -Xcc=-fmodule-file=M=/local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp/mod.pcm      -Xcc=--target=x86_64-linux-gnu | /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/bin/FileCheck /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp/import.cpp
# executed command: cat /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp/import.cpp
# .---command stdout------------
# | 
# | %lib libmod.so
# | 
# | import M;
# | 
# | extern "C" int printf(const char *, ...);
# | printf("%s\n", Hello());
# | 
# | // CHECK: Hello Interpreter for Modules!
# `-----------------------------
# executed command: env 'LD_LIBRARY_PATH=/local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp:$LD_LIBRARY_PATH' /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/bin/clang-repl -Xcc=-std=c++20 -Xcc=-fmodule-file=M=/local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp/mod.pcm -Xcc=--target=x86_64-linux-gnu
# .---command stderr------------
# | /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/bin/clang-repl: error while loading shared libraries: libc++.so.1: cannot open shared object file: No such file or directory
# `-----------------------------
# error: command failed with exit status: 127
# executed command: /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/bin/FileCheck /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp/import.cpp
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/bin/FileCheck /local/mnt/workspace/bots/hexagon-build-03/reverse-iteration/llvm.obj/tools/clang/test/Interpreter/Output/cxx20-modules.cppm.tmp/import.cpp
# `-----------------------------
# error: command failed with exit status: 2

--
...

mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Dec 19, 2025
The pass now contains a non-fp expansion and should
be used for any similar expansions regardless of the
types involved. Hence a generic name seems apt.

Rename the source files, pass, and adjust the pass
description. Move all tests for the expansions
that have previously been merged into the pass
to a single directory.
@llvm-ci

llvm-ci commented Dec 24, 2025

Copy link
Copy Markdown

LLVM Buildbot has detected a new failure on builder clang-ppc64le-linux-multistage running on ppc64le-clang-multistage-test while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/76/builds/13637

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LeakSanitizer-Standalone-powerpc64le :: TestCases/create_thread_leak.cpp' FAILED ********************
Exit Code: 2

Command Output (stdout):
--
# RUN: at line 3
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/./bin/clang  --driver-mode=g++ -O0  -m64 -fno-function-sections  -gline-tables-only -fsanitize=leak -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/compiler-rt/test/lsan/../ -pthread /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/compiler-rt/test/lsan/TestCases/create_thread_leak.cpp -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/lsan/POWERPC64LELsanConfig/TestCases/Output/create_thread_leak.cpp.tmp
# executed command: /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/./bin/clang --driver-mode=g++ -O0 -m64 -fno-function-sections -gline-tables-only -fsanitize=leak -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/compiler-rt/test/lsan/../ -pthread /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/compiler-rt/test/lsan/TestCases/create_thread_leak.cpp -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/lsan/POWERPC64LELsanConfig/TestCases/Output/create_thread_leak.cpp.tmp
# RUN: at line 4
not  /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/lsan/POWERPC64LELsanConfig/TestCases/Output/create_thread_leak.cpp.tmp 10 1 0 0 2>&1 | FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/compiler-rt/test/lsan/TestCases/create_thread_leak.cpp --check-prefixes=LEAK,LEAK123
# executed command: not /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/lsan/POWERPC64LELsanConfig/TestCases/Output/create_thread_leak.cpp.tmp 10 1 0 0
# executed command: FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/compiler-rt/test/lsan/TestCases/create_thread_leak.cpp --check-prefixes=LEAK,LEAK123
# RUN: at line 5
not  /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/lsan/POWERPC64LELsanConfig/TestCases/Output/create_thread_leak.cpp.tmp 10 0 1 0 2>&1 | FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/compiler-rt/test/lsan/TestCases/create_thread_leak.cpp --check-prefixes=LEAK,LEAK234
# executed command: not /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/lsan/POWERPC64LELsanConfig/TestCases/Output/create_thread_leak.cpp.tmp 10 0 1 0
# executed command: FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/compiler-rt/test/lsan/TestCases/create_thread_leak.cpp --check-prefixes=LEAK,LEAK234
# RUN: at line 6
not  /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/lsan/POWERPC64LELsanConfig/TestCases/Output/create_thread_leak.cpp.tmp 10 0 0 1 2>&1 | FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/compiler-rt/test/lsan/TestCases/create_thread_leak.cpp --check-prefixes=LEAK,LEAK234
# executed command: not /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/runtimes/runtimes-bins/compiler-rt/test/lsan/POWERPC64LELsanConfig/TestCases/Output/create_thread_leak.cpp.tmp 10 0 0 1
# note: command had no output on stdout or stderr
# error: command failed with exit status: 1
# executed command: FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/compiler-rt/test/lsan/TestCases/create_thread_leak.cpp --check-prefixes=LEAK,LEAK234
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/compiler-rt/test/lsan/TestCases/create_thread_leak.cpp --check-prefixes=LEAK,LEAK234
# `-----------------------------
# error: command failed with exit status: 2

--

********************


trdthg added a commit to buddy-compiler/buddy-mlir that referenced this pull request May 29, 2026
## Version and Build Flow

- fetch branch / apply local patch -> fetch exact submodule commit with
  `git fetch origin "${LLVM_COMMIT}"`
- `LLVM_COMMIT + riscv-jitlink.patch hash` -> `LLVM_COMMIT` cache key
- apply `riscv-jitlink.patch` -> no patch; current LLVM already has the fix
- [#172581](llvm/llvm-project#172581) / 3d7018c70b97: `nanobind` /
  `nanobind==2.4.*` -> `nanobind>=2.9,<3.0` / `nanobind==2.9.*`

## Python Bindings

- [#172581](llvm/llvm-project#172581) / 3d7018c70b97:
  `PybindAdaptors.h` -> `NanobindAdaptors.h`
- [#172581](llvm/llvm-project#172581) / 3d7018c70b97:
  `PYBIND11_MODULE` -> `NB_MODULE`
- [#172581](llvm/llvm-project#172581) / 3d7018c70b97: manual
  pybind/nanobind CMake setup -> `mlir_configure_python_dev_packages()`

## MLIR API

- [#162167](llvm/llvm-project#162167) / ea291d0e8c93:
  `vector::SplatOp` -> `vector::BroadcastOp`
- [#149603](llvm/llvm-project#149603) / 33465bb2bb75:
  `vector::InsertElementOp` -> `vector::InsertOp`
- [#149603](llvm/llvm-project#149603) / 33465bb2bb75:
  `vector::ExtractElementOp` -> `vector::ExtractOp`
- [#145445](llvm/llvm-project#145445) / 63f30d7d820c:
  `ValueRange{std::nullopt}` -> `ValueRange{}`
- [#145445](llvm/llvm-project#145445) / 63f30d7d820c:
  `TypeRange(std::nullopt)` -> `TypeRange{}`
- [#145445](llvm/llvm-project#145445) / 63f30d7d820c: empty
  `scf.yield` with null operands -> empty `scf.yield`
- [#196082](llvm/llvm-project#196082) / dd57b0c9728a:
  `computeConstantBound(..., /*closedUB=*/true)` ->
  `computeConstantBound(..., ValueBoundsOptions{/*closedUB=*/true})`
- [#182715](llvm/llvm-project#182715) / 72f5050ae765:
  `applyPatternsAndFoldGreedily(...)` -> `applyPatternsGreedily(...)`

## GPU and AMX

- [#188905](llvm/llvm-project#188905) / c1cff89bdcea:
  `launchOp.getWorkgroupAttributions()` ->
  `launchOp.getWorkgroupAttributionBBArgs()`
- [#188905](llvm/llvm-project#188905) / c1cff89bdcea: manual
  `gpu.kernel` attr -> `outlinedFunc.setKernel(true)`
- [#188905](llvm/llvm-project#188905) / c1cff89bdcea:
  `setAttr(getKnown*AttrName(), ...)` ->
  `setKnownBlockSizeAttr(...)` / `setKnownGridSizeAttr(...)`
- [#111197](llvm/llvm-project#111197) / 2f743ac52e94:
  `mlir/Dialect/AMX/AMXDialect.h` -> `mlir/Dialect/X86/X86Dialect.h`
- [#111197](llvm/llvm-project#111197) / 2f743ac52e94:
  `mlir::amx::AMXDialect` -> `mlir::x86::X86Dialect`

## LLVM Source Lists

- [#167271](llvm/llvm-project#167271) / 2345b7d98f75:
  `InlineSizeEstimatorAnalysis.cpp` -> removed upstream; no Buddy source-list
  entry needed
- [#172680](llvm/llvm-project#172680) / 71760f324ff9:
  `ExpandLargeDivRem.cpp` -> merged into `ExpandFp.cpp`
- [#172681](llvm/llvm-project#172681) / 5c05824d2bd3:
  `ExpandFp.cpp` / merged `ExpandLargeDivRem.cpp` -> `ExpandIRInsts.cpp`
- [#77370](llvm/llvm-project#77370) / 5e0a06b34d09:
  `ExpandMemCmp.cpp` in CodeGen -> moved to `Transforms/Scalar`
- [#181547](llvm/llvm-project#181547) / 9a0d65cdfd0d:
  `CallBrPrepare.cpp` -> `InlineAsmPrepare.cpp`
- [#160454](llvm/llvm-project#160454) / aa6a33ae6556:
  `EVLIndVarSimplify.cpp` -> removed upstream; no Buddy source-list entry needed
- [#192635](llvm/llvm-project#192635) / 680a9908194e:
  `VPlanSLP.cpp` -> removed upstream; no Buddy source-list entry needed

## RISC-V Backend

- local Buddy `M0`-`M7` definitions -> upstream RISC-V `M0`-`M7` definitions
- Buddy `MatrixReg` using local mask regs -> `MatrixReg` using upstream mask regs
- IME `*N` instructions in disassembler tables -> mark affected instructions
  `isCodeGenOnly = 1`

## Tool API and Link Libraries

- [#156715](llvm/llvm-project#156715) / dfbd76bda01e:
  `Expected<std::unique_ptr<ToolOutputFile>>` from
  `setupLLVMOptimizationRemarks` -> `Expected<LLVMRemarkFileHandle>`
- [#186998](llvm/llvm-project#186998) / 69cd746bd2f1:
  `codegen::setFunctionAttributes(CPUStr, FeaturesStr, F)` ->
  `codegen::setFunctionAttributes(F, CPUStr, FeaturesStr[, TuneCPUStr])`
- [#186998](llvm/llvm-project#186998) / 69cd746bd2f1:
  `codegen::setFunctionAttributes(CPUStr, FeaturesStr, *M)` ->
  `codegen::setFunctionAttributes(*M, CPUStr, FeaturesStr[, TuneCPUStr])`
- [#87226](llvm/llvm-project#87226) / d0e72ccc54df:
  `TargetMachine::buildCodeGenPipeline(MPM, OS, DwoOut, FileType, Opt, PIC)` ->
  pass `MAM` and `MMI.getContext()`
- [#170846](llvm/llvm-project#170846) / cd806d7e7689: `buddy-llc`
  without `Plugins` -> link LLVM `Plugins`
- [#150805](llvm/llvm-project#150805) / ace42cf063a5,
  [#151150](llvm/llvm-project#151150) / e68a20e0b762: implicit MLIR
  register-all symbols -> link `MLIRRegisterAllDialects`,
  `MLIRRegisterAllExtensions`, `MLIRRegisterAllPasses`
trdthg added a commit to buddy-compiler/buddy-mlir that referenced this pull request May 29, 2026
- fetch branch / apply local patch -> fetch exact submodule commit with
  `git fetch origin "${LLVM_COMMIT}"`
- `LLVM_COMMIT + riscv-jitlink.patch hash` -> `LLVM_COMMIT` cache key
- apply `riscv-jitlink.patch` -> no patch; current LLVM already has the fix
- [#172581](llvm/llvm-project#172581) / 3d7018c70b97: `nanobind` /
  `nanobind==2.4.*` -> `nanobind>=2.9,<3.0` / `nanobind==2.9.*`

- [#172581](llvm/llvm-project#172581) / 3d7018c70b97:
  `PybindAdaptors.h` -> `NanobindAdaptors.h`
- [#172581](llvm/llvm-project#172581) / 3d7018c70b97:
  `PYBIND11_MODULE` -> `NB_MODULE`
- [#172581](llvm/llvm-project#172581) / 3d7018c70b97: manual
  pybind/nanobind CMake setup -> `mlir_configure_python_dev_packages()`

- [#162167](llvm/llvm-project#162167) / ea291d0e8c93:
  `vector::SplatOp` -> `vector::BroadcastOp`
- [#149603](llvm/llvm-project#149603) / 33465bb2bb75:
  `vector::InsertElementOp` -> `vector::InsertOp`
- [#149603](llvm/llvm-project#149603) / 33465bb2bb75:
  `vector::ExtractElementOp` -> `vector::ExtractOp`
- [#145445](llvm/llvm-project#145445) / 63f30d7d820c:
  `ValueRange{std::nullopt}` -> `ValueRange{}`
- [#145445](llvm/llvm-project#145445) / 63f30d7d820c:
  `TypeRange(std::nullopt)` -> `TypeRange{}`
- [#145445](llvm/llvm-project#145445) / 63f30d7d820c: empty
  `scf.yield` with null operands -> empty `scf.yield`
- [#196082](llvm/llvm-project#196082) / dd57b0c9728a:
  `computeConstantBound(..., /*closedUB=*/true)` ->
  `computeConstantBound(..., ValueBoundsOptions{/*closedUB=*/true})`
- [#182715](llvm/llvm-project#182715) / 72f5050ae765:
  `applyPatternsAndFoldGreedily(...)` -> `applyPatternsGreedily(...)`

- [#188905](llvm/llvm-project#188905) / c1cff89bdcea:
  `launchOp.getWorkgroupAttributions()` ->
  `launchOp.getWorkgroupAttributionBBArgs()`
- [#188905](llvm/llvm-project#188905) / c1cff89bdcea: manual
  `gpu.kernel` attr -> `outlinedFunc.setKernel(true)`
- [#188905](llvm/llvm-project#188905) / c1cff89bdcea:
  `setAttr(getKnown*AttrName(), ...)` ->
  `setKnownBlockSizeAttr(...)` / `setKnownGridSizeAttr(...)`
- [#111197](llvm/llvm-project#111197) / 2f743ac52e94:
  `mlir/Dialect/AMX/AMXDialect.h` -> `mlir/Dialect/X86/X86Dialect.h`
- [#111197](llvm/llvm-project#111197) / 2f743ac52e94:
  `mlir::amx::AMXDialect` -> `mlir::x86::X86Dialect`

- [#167271](llvm/llvm-project#167271) / 2345b7d98f75:
  `InlineSizeEstimatorAnalysis.cpp` -> removed upstream; no Buddy source-list
  entry needed
- [#172680](llvm/llvm-project#172680) / 71760f324ff9:
  `ExpandLargeDivRem.cpp` -> merged into `ExpandFp.cpp`
- [#172681](llvm/llvm-project#172681) / 5c05824d2bd3:
  `ExpandFp.cpp` / merged `ExpandLargeDivRem.cpp` -> `ExpandIRInsts.cpp`
- [#77370](llvm/llvm-project#77370) / 5e0a06b34d09:
  `ExpandMemCmp.cpp` in CodeGen -> moved to `Transforms/Scalar`
- [#181547](llvm/llvm-project#181547) / 9a0d65cdfd0d:
  `CallBrPrepare.cpp` -> `InlineAsmPrepare.cpp`
- [#160454](llvm/llvm-project#160454) / aa6a33ae6556:
  `EVLIndVarSimplify.cpp` -> removed upstream; no Buddy source-list entry needed
- [#192635](llvm/llvm-project#192635) / 680a9908194e:
  `VPlanSLP.cpp` -> removed upstream; no Buddy source-list entry needed

- local Buddy `M0`-`M7` definitions -> upstream RISC-V `M0`-`M7` definitions
- Buddy `MatrixReg` using local mask regs -> `MatrixReg` using upstream mask regs
- IME `*N` instructions in disassembler tables -> mark affected instructions
  `isCodeGenOnly = 1`

- [#156715](llvm/llvm-project#156715) / dfbd76bda01e:
  `Expected<std::unique_ptr<ToolOutputFile>>` from
  `setupLLVMOptimizationRemarks` -> `Expected<LLVMRemarkFileHandle>`
- [#186998](llvm/llvm-project#186998) / 69cd746bd2f1:
  `codegen::setFunctionAttributes(CPUStr, FeaturesStr, F)` ->
  `codegen::setFunctionAttributes(F, CPUStr, FeaturesStr[, TuneCPUStr])`
- [#186998](llvm/llvm-project#186998) / 69cd746bd2f1:
  `codegen::setFunctionAttributes(CPUStr, FeaturesStr, *M)` ->
  `codegen::setFunctionAttributes(*M, CPUStr, FeaturesStr[, TuneCPUStr])`
- [#87226](llvm/llvm-project#87226) / d0e72ccc54df:
  `TargetMachine::buildCodeGenPipeline(MPM, OS, DwoOut, FileType, Opt, PIC)` ->
  pass `MAM` and `MMI.getContext()`
- [#170846](llvm/llvm-project#170846) / cd806d7e7689: `buddy-llc`
  without `Plugins` -> link LLVM `Plugins`
- [#150805](llvm/llvm-project#150805) / ace42cf063a5,
  [#151150](llvm/llvm-project#151150) / e68a20e0b762: implicit MLIR
  register-all symbols -> link `MLIRRegisterAllDialects`,
  `MLIRRegisterAllExtensions`, `MLIRRegisterAllPasses`
trdthg added a commit to buddy-compiler/buddy-mlir that referenced this pull request May 29, 2026
- fetch branch / apply local patch -> fetch exact submodule commit with
  `git fetch origin "${LLVM_COMMIT}"`
- `LLVM_COMMIT + riscv-jitlink.patch hash` -> `LLVM_COMMIT` cache key
- apply `riscv-jitlink.patch` -> no patch; current LLVM already has the fix
- [#172581](llvm/llvm-project#172581) / 3d7018c70b97: `nanobind` /
  `nanobind==2.4.*` -> `nanobind>=2.9,<3.0` / `nanobind==2.9.*`

- [#172581](llvm/llvm-project#172581) / 3d7018c70b97:
  `PybindAdaptors.h` -> `NanobindAdaptors.h`
- [#172581](llvm/llvm-project#172581) / 3d7018c70b97:
  `PYBIND11_MODULE` -> `NB_MODULE`
- [#172581](llvm/llvm-project#172581) / 3d7018c70b97: manual
  pybind/nanobind CMake setup -> `mlir_configure_python_dev_packages()`

- [#162167](llvm/llvm-project#162167) / ea291d0e8c93:
  `vector::SplatOp` -> `vector::BroadcastOp`
- [#149603](llvm/llvm-project#149603) / 33465bb2bb75:
  `vector::InsertElementOp` -> `vector::InsertOp`
- [#149603](llvm/llvm-project#149603) / 33465bb2bb75:
  `vector::ExtractElementOp` -> `vector::ExtractOp`
- [#145445](llvm/llvm-project#145445) / 63f30d7d820c:
  `ValueRange{std::nullopt}` -> `ValueRange{}`
- [#145445](llvm/llvm-project#145445) / 63f30d7d820c:
  `TypeRange(std::nullopt)` -> `TypeRange{}`
- [#145445](llvm/llvm-project#145445) / 63f30d7d820c: empty
  `scf.yield` with null operands -> empty `scf.yield`
- [#196082](llvm/llvm-project#196082) / dd57b0c9728a:
  `computeConstantBound(..., /*closedUB=*/true)` ->
  `computeConstantBound(..., ValueBoundsOptions{/*closedUB=*/true})`
- [#182715](llvm/llvm-project#182715) / 72f5050ae765:
  `applyPatternsAndFoldGreedily(...)` -> `applyPatternsGreedily(...)`

- [#188905](llvm/llvm-project#188905) / c1cff89bdcea:
  `launchOp.getWorkgroupAttributions()` ->
  `launchOp.getWorkgroupAttributionBBArgs()`
- [#188905](llvm/llvm-project#188905) / c1cff89bdcea: manual
  `gpu.kernel` attr -> `outlinedFunc.setKernel(true)`
- [#188905](llvm/llvm-project#188905) / c1cff89bdcea:
  `setAttr(getKnown*AttrName(), ...)` ->
  `setKnownBlockSizeAttr(...)` / `setKnownGridSizeAttr(...)`
- [#111197](llvm/llvm-project#111197) / 2f743ac52e94:
  `mlir/Dialect/AMX/AMXDialect.h` -> `mlir/Dialect/X86/X86Dialect.h`
- [#111197](llvm/llvm-project#111197) / 2f743ac52e94:
  `mlir::amx::AMXDialect` -> `mlir::x86::X86Dialect`

- [#167271](llvm/llvm-project#167271) / 2345b7d98f75:
  `InlineSizeEstimatorAnalysis.cpp` -> removed upstream; no Buddy source-list
  entry needed
- [#172680](llvm/llvm-project#172680) / 71760f324ff9:
  `ExpandLargeDivRem.cpp` -> merged into `ExpandFp.cpp`
- [#172681](llvm/llvm-project#172681) / 5c05824d2bd3:
  `ExpandFp.cpp` / merged `ExpandLargeDivRem.cpp` -> `ExpandIRInsts.cpp`
- [#77370](llvm/llvm-project#77370) / 5e0a06b34d09:
  `ExpandMemCmp.cpp` in CodeGen -> moved to `Transforms/Scalar`
- [#181547](llvm/llvm-project#181547) / 9a0d65cdfd0d:
  `CallBrPrepare.cpp` -> `InlineAsmPrepare.cpp`
- [#160454](llvm/llvm-project#160454) / aa6a33ae6556:
  `EVLIndVarSimplify.cpp` -> removed upstream; no Buddy source-list entry needed
- [#192635](llvm/llvm-project#192635) / 680a9908194e:
  `VPlanSLP.cpp` -> removed upstream; no Buddy source-list entry needed

- local Buddy `M0`-`M7` definitions -> upstream RISC-V `M0`-`M7` definitions
- Buddy `MatrixReg` using local mask regs -> `MatrixReg` using upstream mask regs
- IME `*N` instructions in disassembler tables -> mark affected instructions
  `isCodeGenOnly = 1`

- [#156715](llvm/llvm-project#156715) / dfbd76bda01e:
  `Expected<std::unique_ptr<ToolOutputFile>>` from
  `setupLLVMOptimizationRemarks` -> `Expected<LLVMRemarkFileHandle>`
- [#186998](llvm/llvm-project#186998) / 69cd746bd2f1:
  `codegen::setFunctionAttributes(CPUStr, FeaturesStr, F)` ->
  `codegen::setFunctionAttributes(F, CPUStr, FeaturesStr[, TuneCPUStr])`
- [#186998](llvm/llvm-project#186998) / 69cd746bd2f1:
  `codegen::setFunctionAttributes(CPUStr, FeaturesStr, *M)` ->
  `codegen::setFunctionAttributes(*M, CPUStr, FeaturesStr[, TuneCPUStr])`
- [#87226](llvm/llvm-project#87226) / d0e72ccc54df:
  `TargetMachine::buildCodeGenPipeline(MPM, OS, DwoOut, FileType, Opt, PIC)` ->
  pass `MAM` and `MMI.getContext()`
- [#170846](llvm/llvm-project#170846) / cd806d7e7689: `buddy-llc`
  without `Plugins` -> link LLVM `Plugins`
- [#150805](llvm/llvm-project#150805) / ace42cf063a5,
  [#151150](llvm/llvm-project#151150) / e68a20e0b762: implicit MLIR
  register-all symbols -> link `MLIRRegisterAllDialects`,
  `MLIRRegisterAllExtensions`, `MLIRRegisterAllPasses`
trdthg added a commit to buddy-compiler/buddy-mlir that referenced this pull request Jun 1, 2026
- fetch branch / apply local patch -> fetch exact submodule commit with
  `git fetch origin "${LLVM_COMMIT}"`
- `LLVM_COMMIT + riscv-jitlink.patch hash` -> `LLVM_COMMIT` cache key
- apply `riscv-jitlink.patch` -> no patch; current LLVM already has the fix
- [#172581](llvm/llvm-project#172581) / 3d7018c70b97: `nanobind` /
  `nanobind==2.4.*` -> `nanobind>=2.9,<3.0` / `nanobind==2.9.*`

- [#172581](llvm/llvm-project#172581) / 3d7018c70b97:
  `PybindAdaptors.h` -> `NanobindAdaptors.h`
- [#172581](llvm/llvm-project#172581) / 3d7018c70b97:
  `PYBIND11_MODULE` -> `NB_MODULE`
- [#172581](llvm/llvm-project#172581) / 3d7018c70b97: manual
  pybind/nanobind CMake setup -> `mlir_configure_python_dev_packages()`

- [#162167](llvm/llvm-project#162167) / ea291d0e8c93:
  `vector::SplatOp` -> `vector::BroadcastOp`
- [#149603](llvm/llvm-project#149603) / 33465bb2bb75:
  `vector::InsertElementOp` -> `vector::InsertOp`
- [#149603](llvm/llvm-project#149603) / 33465bb2bb75:
  `vector::ExtractElementOp` -> `vector::ExtractOp`
- [#145445](llvm/llvm-project#145445) / 63f30d7d820c:
  `ValueRange{std::nullopt}` -> `ValueRange{}`
- [#145445](llvm/llvm-project#145445) / 63f30d7d820c:
  `TypeRange(std::nullopt)` -> `TypeRange{}`
- [#145445](llvm/llvm-project#145445) / 63f30d7d820c: empty
  `scf.yield` with null operands -> empty `scf.yield`
- [#196082](llvm/llvm-project#196082) / dd57b0c9728a:
  `computeConstantBound(..., /*closedUB=*/true)` ->
  `computeConstantBound(..., ValueBoundsOptions{/*closedUB=*/true})`
- [#182715](llvm/llvm-project#182715) / 72f5050ae765:
  `applyPatternsAndFoldGreedily(...)` -> `applyPatternsGreedily(...)`

- [#188905](llvm/llvm-project#188905) / c1cff89bdcea:
  `launchOp.getWorkgroupAttributions()` ->
  `launchOp.getWorkgroupAttributionBBArgs()`
- [#188905](llvm/llvm-project#188905) / c1cff89bdcea: manual
  `gpu.kernel` attr -> `outlinedFunc.setKernel(true)`
- [#188905](llvm/llvm-project#188905) / c1cff89bdcea:
  `setAttr(getKnown*AttrName(), ...)` ->
  `setKnownBlockSizeAttr(...)` / `setKnownGridSizeAttr(...)`
- [#111197](llvm/llvm-project#111197) / 2f743ac52e94:
  `mlir/Dialect/AMX/AMXDialect.h` -> `mlir/Dialect/X86/X86Dialect.h`
- [#111197](llvm/llvm-project#111197) / 2f743ac52e94:
  `mlir::amx::AMXDialect` -> `mlir::x86::X86Dialect`

- [#167271](llvm/llvm-project#167271) / 2345b7d98f75:
  `InlineSizeEstimatorAnalysis.cpp` -> removed upstream; no Buddy source-list
  entry needed
- [#172680](llvm/llvm-project#172680) / 71760f324ff9:
  `ExpandLargeDivRem.cpp` -> merged into `ExpandFp.cpp`
- [#172681](llvm/llvm-project#172681) / 5c05824d2bd3:
  `ExpandFp.cpp` / merged `ExpandLargeDivRem.cpp` -> `ExpandIRInsts.cpp`
- [#77370](llvm/llvm-project#77370) / 5e0a06b34d09:
  `ExpandMemCmp.cpp` in CodeGen -> moved to `Transforms/Scalar`
- [#181547](llvm/llvm-project#181547) / 9a0d65cdfd0d:
  `CallBrPrepare.cpp` -> `InlineAsmPrepare.cpp`
- [#160454](llvm/llvm-project#160454) / aa6a33ae6556:
  `EVLIndVarSimplify.cpp` -> removed upstream; no Buddy source-list entry needed
- [#192635](llvm/llvm-project#192635) / 680a9908194e:
  `VPlanSLP.cpp` -> removed upstream; no Buddy source-list entry needed

- local Buddy `M0`-`M7` definitions -> upstream RISC-V `M0`-`M7` definitions
- Buddy `MatrixReg` using local mask regs -> `MatrixReg` using upstream mask regs
- IME `*N` instructions in disassembler tables -> mark affected instructions
  `isCodeGenOnly = 1`

- [#156715](llvm/llvm-project#156715) / dfbd76bda01e:
  `Expected<std::unique_ptr<ToolOutputFile>>` from
  `setupLLVMOptimizationRemarks` -> `Expected<LLVMRemarkFileHandle>`
- [#186998](llvm/llvm-project#186998) / 69cd746bd2f1:
  `codegen::setFunctionAttributes(CPUStr, FeaturesStr, F)` ->
  `codegen::setFunctionAttributes(F, CPUStr, FeaturesStr[, TuneCPUStr])`
- [#186998](llvm/llvm-project#186998) / 69cd746bd2f1:
  `codegen::setFunctionAttributes(CPUStr, FeaturesStr, *M)` ->
  `codegen::setFunctionAttributes(*M, CPUStr, FeaturesStr[, TuneCPUStr])`
- [#87226](llvm/llvm-project#87226) / d0e72ccc54df:
  `TargetMachine::buildCodeGenPipeline(MPM, OS, DwoOut, FileType, Opt, PIC)` ->
  pass `MAM` and `MMI.getContext()`
- [#170846](llvm/llvm-project#170846) / cd806d7e7689: `buddy-llc`
  without `Plugins` -> link LLVM `Plugins`
- [#150805](llvm/llvm-project#150805) / ace42cf063a5,
  [#151150](llvm/llvm-project#151150) / e68a20e0b762: implicit MLIR
  register-all symbols -> link `MLIRRegisterAllDialects`,
  `MLIRRegisterAllExtensions`, `MLIRRegisterAllPasses`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants