[llvm] [CodeGen] Merge ExpandLargeDivRem into ExpandFp (PR #172680)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 17 08:09:34 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-x86
Author: Frederik Harwath (frederik-h)
<details>
<summary>Changes</summary>
Both passes expand instructions at the IR level.
They use the same kind of instruction visitation
logic and contain significant code duplication e.g.
for scalarization.
---
Patch is 52.19 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/172680.diff
37 Files Affected:
- (modified) llvm/docs/WritingAnLLVMPass.rst (-1)
- (removed) llvm/include/llvm/CodeGen/ExpandLargeDivRem.h (-30)
- (modified) llvm/include/llvm/CodeGen/Passes.h (-3)
- (modified) llvm/include/llvm/CodeGen/TargetLowering.h (+3-3)
- (modified) llvm/include/llvm/InitializePasses.h (-1)
- (modified) llvm/include/llvm/LinkAllPasses.h (-1)
- (modified) llvm/include/llvm/Passes/CodeGenPassBuilder.h (-2)
- (modified) llvm/lib/CodeGen/CMakeLists.txt (-1)
- (modified) llvm/lib/CodeGen/CodeGen.cpp (-1)
- (modified) llvm/lib/CodeGen/ExpandFp.cpp (+55-1)
- (removed) llvm/lib/CodeGen/ExpandLargeDivRem.cpp (-182)
- (modified) llvm/lib/CodeGen/TargetPassConfig.cpp (-1)
- (modified) llvm/lib/Passes/PassBuilder.cpp (-1)
- (modified) llvm/lib/Passes/PassRegistry.def (-1)
- (modified) llvm/test/CodeGen/AArch64/O0-pipeline.ll (-1)
- (modified) llvm/test/CodeGen/AArch64/O3-pipeline.ll (-1)
- (modified) llvm/test/CodeGen/AMDGPU/llc-pipeline-npm.ll (+3-3)
- (modified) llvm/test/CodeGen/AMDGPU/llc-pipeline.ll (-5)
- (modified) llvm/test/CodeGen/ARM/O3-pipeline.ll (-1)
- (modified) llvm/test/CodeGen/LoongArch/O0-pipeline.ll (-1)
- (modified) llvm/test/CodeGen/LoongArch/opt-pipeline.ll (-1)
- (modified) llvm/test/CodeGen/M68k/pipeline.ll (-1)
- (modified) llvm/test/CodeGen/PowerPC/O0-pipeline.ll (-1)
- (modified) llvm/test/CodeGen/PowerPC/O3-pipeline.ll (-1)
- (modified) llvm/test/CodeGen/RISCV/O0-pipeline.ll (-1)
- (modified) llvm/test/CodeGen/RISCV/O3-pipeline.ll (-1)
- (modified) llvm/test/CodeGen/SPIRV/llc-pipeline.ll (-2)
- (modified) llvm/test/CodeGen/X86/O0-pipeline.ll (-1)
- (modified) llvm/test/CodeGen/X86/opt-pipeline.ll (-1)
- (modified) llvm/test/Transforms/ExpandLargeDivRem/X86/sdiv129.ll (+2-2)
- (modified) llvm/test/Transforms/ExpandLargeDivRem/X86/srem129.ll (+2-2)
- (modified) llvm/test/Transforms/ExpandLargeDivRem/X86/udiv129.ll (+2-2)
- (modified) llvm/test/Transforms/ExpandLargeDivRem/X86/urem129.ll (+2-2)
- (modified) llvm/test/Transforms/ExpandLargeDivRem/X86/vector.ll (+2-2)
- (modified) llvm/test/tools/opt/no-target-machine.ll (+1-1)
- (modified) llvm/tools/opt/optdriver.cpp (-2)
- (modified) llvm/utils/gn/secondary/llvm/lib/CodeGen/BUILD.gn (-1)
``````````diff
diff --git a/llvm/docs/WritingAnLLVMPass.rst b/llvm/docs/WritingAnLLVMPass.rst
index eec9887d08ede..f475676e15367 100644
--- a/llvm/docs/WritingAnLLVMPass.rst
+++ b/llvm/docs/WritingAnLLVMPass.rst
@@ -673,7 +673,6 @@ default optimization pipelines, e.g. (the output has been trimmed):
ModulePass Manager
Pre-ISel Intrinsic Lowering
FunctionPass Manager
- Expand large div/rem
Expand fp
Expand Atomic instructions
SVE intrinsics optimizations
diff --git a/llvm/include/llvm/CodeGen/ExpandLargeDivRem.h b/llvm/include/llvm/CodeGen/ExpandLargeDivRem.h
deleted file mode 100644
index b73a382e93b5a..0000000000000
--- a/llvm/include/llvm/CodeGen/ExpandLargeDivRem.h
+++ /dev/null
@@ -1,30 +0,0 @@
-//===- ExpandLargeDivRem.h --------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CODEGEN_EXPANDLARGEDIVREM_H
-#define LLVM_CODEGEN_EXPANDLARGEDIVREM_H
-
-#include "llvm/IR/PassManager.h"
-
-namespace llvm {
-
-class TargetMachine;
-
-class ExpandLargeDivRemPass : public PassInfoMixin<ExpandLargeDivRemPass> {
-private:
- const TargetMachine *TM;
-
-public:
- explicit ExpandLargeDivRemPass(const TargetMachine &TM_) : TM(&TM_) {}
-
- PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
-};
-
-} // end namespace llvm
-
-#endif // LLVM_CODEGEN_EXPANDLARGEDIVREM_H
diff --git a/llvm/include/llvm/CodeGen/Passes.h b/llvm/include/llvm/CodeGen/Passes.h
index 2bf83cfa655b6..08dabd69a48e9 100644
--- a/llvm/include/llvm/CodeGen/Passes.h
+++ b/llvm/include/llvm/CodeGen/Passes.h
@@ -546,9 +546,6 @@ LLVM_ABI FunctionPass *createExpandReductionsPass();
// the corresponding function in a vector library (e.g., SVML, libmvec).
LLVM_ABI FunctionPass *createReplaceWithVeclibLegacyPass();
-// Expands large div/rem instructions.
-LLVM_ABI FunctionPass *createExpandLargeDivRemPass();
-
// Expands large div/rem instructions.
LLVM_ABI FunctionPass *createExpandFpPass();
diff --git a/llvm/include/llvm/CodeGen/TargetLowering.h b/llvm/include/llvm/CodeGen/TargetLowering.h
index 50dcac6c7d438..06bc5caefd063 100644
--- a/llvm/include/llvm/CodeGen/TargetLowering.h
+++ b/llvm/include/llvm/CodeGen/TargetLowering.h
@@ -2220,7 +2220,7 @@ class LLVM_ABI TargetLoweringBase {
}
/// Returns the size in bits of the maximum div/rem the backend supports.
- /// Larger operations will be expanded by ExpandLargeDivRem.
+ /// Larger operations will be expanded by ExpandFp.
unsigned getMaxDivRemBitWidthSupported() const {
return MaxDivRemBitWidthSupported;
}
@@ -2886,7 +2886,7 @@ class LLVM_ABI TargetLoweringBase {
}
/// Set the size in bits of the maximum div/rem the backend supports.
- /// Larger operations will be expanded by ExpandLargeDivRem.
+ /// Larger operations will be expanded by ExpandFp.
void setMaxDivRemBitWidthSupported(unsigned SizeInBits) {
MaxDivRemBitWidthSupported = SizeInBits;
}
@@ -3743,7 +3743,7 @@ class LLVM_ABI TargetLoweringBase {
unsigned MaxAtomicSizeInBitsSupported;
/// Size in bits of the maximum div/rem size the backend supports.
- /// Larger operations will be expanded by ExpandLargeDivRem.
+ /// Larger operations will be expanded by ExpandFp.
unsigned MaxDivRemBitWidthSupported;
/// Size in bits of the maximum fp to/from int conversion size the
diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h
index a5491e68bbe52..b4f96674bea9e 100644
--- a/llvm/include/llvm/InitializePasses.h
+++ b/llvm/include/llvm/InitializePasses.h
@@ -113,7 +113,6 @@ LLVM_ABI void initializeEarlyTailDuplicateLegacyPass(PassRegistry &);
LLVM_ABI void initializeEdgeBundlesWrapperLegacyPass(PassRegistry &);
LLVM_ABI void initializeEHContGuardTargetsPass(PassRegistry &);
LLVM_ABI void initializeExpandFpLegacyPassPass(PassRegistry &);
-LLVM_ABI void initializeExpandLargeDivRemLegacyPassPass(PassRegistry &);
LLVM_ABI void initializeExpandMemCmpLegacyPassPass(PassRegistry &);
LLVM_ABI void initializeExpandPostRALegacyPass(PassRegistry &);
LLVM_ABI void initializeExpandReductionsPass(PassRegistry &);
diff --git a/llvm/include/llvm/LinkAllPasses.h b/llvm/include/llvm/LinkAllPasses.h
index 630bdf96c18df..612e57b52644f 100644
--- a/llvm/include/llvm/LinkAllPasses.h
+++ b/llvm/include/llvm/LinkAllPasses.h
@@ -128,7 +128,6 @@ struct ForcePassLinking {
(void)llvm::createGVNPass();
(void)llvm::createPostDomTree();
(void)llvm::createMergeICmpsLegacyPass();
- (void)llvm::createExpandLargeDivRemPass();
(void)llvm::createExpandMemCmpLegacyPass();
std::string buf;
llvm::raw_string_ostream os(buf);
diff --git a/llvm/include/llvm/Passes/CodeGenPassBuilder.h b/llvm/include/llvm/Passes/CodeGenPassBuilder.h
index f47537d109671..0462adb835d89 100644
--- a/llvm/include/llvm/Passes/CodeGenPassBuilder.h
+++ b/llvm/include/llvm/Passes/CodeGenPassBuilder.h
@@ -33,7 +33,6 @@
#include "llvm/CodeGen/DwarfEHPrepare.h"
#include "llvm/CodeGen/EarlyIfConversion.h"
#include "llvm/CodeGen/ExpandFp.h"
-#include "llvm/CodeGen/ExpandLargeDivRem.h"
#include "llvm/CodeGen/ExpandMemCmp.h"
#include "llvm/CodeGen/ExpandPostRAPseudos.h"
#include "llvm/CodeGen/ExpandReductions.h"
@@ -678,7 +677,6 @@ void CodeGenPassBuilder<Derived, TargetMachineT>::addISelPasses(
addModulePass(LowerEmuTLSPass(), PMW);
addModulePass(PreISelIntrinsicLoweringPass(&TM), PMW);
- addFunctionPass(ExpandLargeDivRemPass(TM), PMW);
addFunctionPass(ExpandFpPass(TM, getOptLevel()), PMW);
derived().addIRPasses(PMW);
diff --git a/llvm/lib/CodeGen/CMakeLists.txt b/llvm/lib/CodeGen/CMakeLists.txt
index 30237e66ed0ec..8c9b172c0da65 100644
--- a/llvm/lib/CodeGen/CMakeLists.txt
+++ b/llvm/lib/CodeGen/CMakeLists.txt
@@ -57,7 +57,6 @@ add_llvm_component_library(LLVMCodeGen
EdgeBundles.cpp
EHContGuardTargets.cpp
ExecutionDomainFix.cpp
- ExpandLargeDivRem.cpp
ExpandFp.cpp
ExpandMemCmp.cpp
ExpandPostRAPseudos.cpp
diff --git a/llvm/lib/CodeGen/CodeGen.cpp b/llvm/lib/CodeGen/CodeGen.cpp
index fe293c63fa762..47633f89b70e9 100644
--- a/llvm/lib/CodeGen/CodeGen.cpp
+++ b/llvm/lib/CodeGen/CodeGen.cpp
@@ -39,7 +39,6 @@ void llvm::initializeCodeGen(PassRegistry &Registry) {
initializeEarlyIfPredicatorPass(Registry);
initializeEarlyMachineLICMPass(Registry);
initializeEarlyTailDuplicateLegacyPass(Registry);
- initializeExpandLargeDivRemLegacyPassPass(Registry);
initializeExpandFpLegacyPassPass(Registry);
initializeExpandMemCmpLegacyPassPass(Registry);
initializeExpandPostRALegacyPass(Registry);
diff --git a/llvm/lib/CodeGen/ExpandFp.cpp b/llvm/lib/CodeGen/ExpandFp.cpp
index 2b48bdfe723a0..395fef19a13b9 100644
--- a/llvm/lib/CodeGen/ExpandFp.cpp
+++ b/llvm/lib/CodeGen/ExpandFp.cpp
@@ -12,6 +12,12 @@
// 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.
+//
//===----------------------------------------------------------------------===//
#include "llvm/CodeGen/ExpandFp.h"
@@ -35,6 +41,8 @@
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
+#include "llvm/Transforms/Utils/IntegerDivision.h"
+#include <llvm/Support/Casting.h>
#include <optional>
#define DEBUG_TYPE "expand-fp"
@@ -47,7 +55,28 @@ static cl::opt<unsigned>
cl::desc("fp convert instructions on integers with "
"more than <N> bits are expanded."));
+static cl::opt<unsigned>
+ ExpandDivRemBits("expand-div-rem-bits", cl::Hidden,
+ cl::init(llvm::IntegerType::MAX_INT_BITS),
+ cl::desc("div and rem instructions on integers with "
+ "more than <N> bits are expanded."));
+
namespace {
+bool isConstantPowerOfTwo(llvm::Value *V, bool SignedOp) {
+ auto *C = dyn_cast<ConstantInt>(V);
+ if (!C)
+ return false;
+
+ APInt Val = C->getValue();
+ if (SignedOp && Val.isNegative())
+ Val = -Val;
+ return Val.isPowerOf2();
+}
+
+bool isSigned(unsigned int Opcode) {
+ return Opcode == Instruction::SDiv || Opcode == Instruction::SRem;
+}
+
/// This class implements a precise expansion of the frem instruction.
/// The generated code is based on the fmod implementation in the AMD device
/// libs.
@@ -995,11 +1024,17 @@ static bool runImpl(Function &F, const TargetLowering &TLI,
if (ExpandFpConvertBits != llvm::IntegerType::MAX_INT_BITS)
MaxLegalFpConvertBitWidth = ExpandFpConvertBits;
+ unsigned MaxLegalDivRemBitWidth = TLI.getMaxDivRemBitWidthSupported();
+ if (ExpandDivRemBits != llvm::IntegerType::MAX_INT_BITS)
+ MaxLegalDivRemBitWidth = ExpandDivRemBits;
+
bool DisableExpandLargeFp =
MaxLegalFpConvertBitWidth >= llvm::IntegerType::MAX_INT_BITS;
+ bool DisableExpandLargeDivRem =
+ MaxLegalDivRemBitWidth >= llvm::IntegerType::MAX_INT_BITS;
bool DisableFrem = !FRemExpander::shouldExpandAnyFremType(TLI);
- if (DisableExpandLargeFp && DisableFrem)
+ if (DisableExpandLargeFp && DisableFrem && DisableExpandLargeDivRem)
return false;
auto ShouldHandleInst = [&](Instruction &I) {
@@ -1021,6 +1056,16 @@ static bool runImpl(Function &F, const TargetLowering &TLI,
return !DisableExpandLargeFp &&
cast<IntegerType>(I.getOperand(0)->getType()->getScalarType())
->getIntegerBitWidth() > MaxLegalFpConvertBitWidth;
+ case Instruction::UDiv:
+ case Instruction::SDiv:
+ case Instruction::URem:
+ case Instruction::SRem:
+ return !DisableExpandLargeDivRem &&
+ cast<IntegerType>(Ty->getScalarType())->getIntegerBitWidth() >
+ MaxLegalDivRemBitWidth
+ // The backend has peephole optimizations for powers of two.
+ // TODO: We don't consider vectors here.
+ && !isConstantPowerOfTwo(I.getOperand(1), isSigned(I.getOpcode()));
}
return false;
@@ -1064,6 +1109,15 @@ static bool runImpl(Function &F, const TargetLowering &TLI,
case Instruction::SIToFP:
expandIToFP(I);
break;
+
+ case Instruction::UDiv:
+ case Instruction::SDiv:
+ expandDivision(cast<BinaryOperator>(I));
+ break;
+ case Instruction::URem:
+ case Instruction::SRem:
+ expandRemainder(cast<BinaryOperator>(I));
+ break;
}
}
diff --git a/llvm/lib/CodeGen/ExpandLargeDivRem.cpp b/llvm/lib/CodeGen/ExpandLargeDivRem.cpp
deleted file mode 100644
index 98b77e9c254ae..0000000000000
--- a/llvm/lib/CodeGen/ExpandLargeDivRem.cpp
+++ /dev/null
@@ -1,182 +0,0 @@
-//===--- ExpandLargeDivRem.cpp - Expand large div/rem ---------------------===//
-//
-// 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 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.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/CodeGen/ExpandLargeDivRem.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/Analysis/GlobalsModRef.h"
-#include "llvm/CodeGen/Passes.h"
-#include "llvm/CodeGen/TargetLowering.h"
-#include "llvm/CodeGen/TargetPassConfig.h"
-#include "llvm/CodeGen/TargetSubtargetInfo.h"
-#include "llvm/IR/IRBuilder.h"
-#include "llvm/IR/InstIterator.h"
-#include "llvm/IR/PassManager.h"
-#include "llvm/InitializePasses.h"
-#include "llvm/Pass.h"
-#include "llvm/Support/CommandLine.h"
-#include "llvm/Target/TargetMachine.h"
-#include "llvm/Transforms/Utils/IntegerDivision.h"
-
-using namespace llvm;
-
-static cl::opt<unsigned>
- ExpandDivRemBits("expand-div-rem-bits", cl::Hidden,
- cl::init(llvm::IntegerType::MAX_INT_BITS),
- cl::desc("div and rem instructions on integers with "
- "more than <N> bits are expanded."));
-
-static bool isConstantPowerOfTwo(llvm::Value *V, bool SignedOp) {
- auto *C = dyn_cast<ConstantInt>(V);
- if (!C)
- return false;
-
- APInt Val = C->getValue();
- if (SignedOp && Val.isNegative())
- Val = -Val;
- return Val.isPowerOf2();
-}
-
-static bool isSigned(unsigned int Opcode) {
- return Opcode == Instruction::SDiv || Opcode == Instruction::SRem;
-}
-
-static void scalarize(BinaryOperator *BO,
- SmallVectorImpl<BinaryOperator *> &Replace) {
- VectorType *VTy = cast<FixedVectorType>(BO->getType());
-
- IRBuilder<> Builder(BO);
-
- unsigned NumElements = VTy->getElementCount().getFixedValue();
- Value *Result = PoisonValue::get(VTy);
- for (unsigned Idx = 0; Idx < NumElements; ++Idx) {
- Value *LHS = Builder.CreateExtractElement(BO->getOperand(0), Idx);
- Value *RHS = Builder.CreateExtractElement(BO->getOperand(1), Idx);
- Value *Op = Builder.CreateBinOp(BO->getOpcode(), LHS, RHS);
- Result = Builder.CreateInsertElement(Result, Op, Idx);
- if (auto *NewBO = dyn_cast<BinaryOperator>(Op)) {
- NewBO->copyIRFlags(Op, true);
- Replace.push_back(NewBO);
- }
- }
- BO->replaceAllUsesWith(Result);
- BO->dropAllReferences();
- BO->eraseFromParent();
-}
-
-static bool runImpl(Function &F, const TargetLowering &TLI) {
- SmallVector<BinaryOperator *, 4> Replace;
- SmallVector<BinaryOperator *, 4> ReplaceVector;
- bool Modified = false;
-
- unsigned MaxLegalDivRemBitWidth = TLI.getMaxDivRemBitWidthSupported();
- if (ExpandDivRemBits != llvm::IntegerType::MAX_INT_BITS)
- MaxLegalDivRemBitWidth = ExpandDivRemBits;
-
- if (MaxLegalDivRemBitWidth >= llvm::IntegerType::MAX_INT_BITS)
- return false;
-
- for (auto &I : instructions(F)) {
- switch (I.getOpcode()) {
- case Instruction::UDiv:
- case Instruction::SDiv:
- case Instruction::URem:
- case Instruction::SRem: {
- // TODO: This pass doesn't handle scalable vectors.
- if (I.getOperand(0)->getType()->isScalableTy())
- continue;
-
- auto *IntTy = dyn_cast<IntegerType>(I.getType()->getScalarType());
- if (!IntTy || IntTy->getIntegerBitWidth() <= MaxLegalDivRemBitWidth)
- continue;
-
- // The backend has peephole optimizations for powers of two.
- // TODO: We don't consider vectors here.
- if (isConstantPowerOfTwo(I.getOperand(1), isSigned(I.getOpcode())))
- continue;
-
- if (I.getOperand(0)->getType()->isVectorTy())
- ReplaceVector.push_back(&cast<BinaryOperator>(I));
- else
- Replace.push_back(&cast<BinaryOperator>(I));
- Modified = true;
- break;
- }
- default:
- break;
- }
- }
-
- while (!ReplaceVector.empty()) {
- BinaryOperator *BO = ReplaceVector.pop_back_val();
- scalarize(BO, Replace);
- }
-
- if (Replace.empty())
- return false;
-
- while (!Replace.empty()) {
- BinaryOperator *I = Replace.pop_back_val();
-
- if (I->getOpcode() == Instruction::UDiv ||
- I->getOpcode() == Instruction::SDiv) {
- expandDivision(I);
- } else {
- expandRemainder(I);
- }
- }
-
- return Modified;
-}
-
-namespace {
-class ExpandLargeDivRemLegacyPass : public FunctionPass {
-public:
- static char ID;
-
- ExpandLargeDivRemLegacyPass() : FunctionPass(ID) {
- initializeExpandLargeDivRemLegacyPassPass(*PassRegistry::getPassRegistry());
- }
-
- bool runOnFunction(Function &F) override {
- auto *TM = &getAnalysis<TargetPassConfig>().getTM<TargetMachine>();
- auto *TLI = TM->getSubtargetImpl(F)->getTargetLowering();
- return runImpl(F, *TLI);
- }
-
- void getAnalysisUsage(AnalysisUsage &AU) const override {
- AU.addRequired<TargetPassConfig>();
- AU.addPreserved<AAResultsWrapperPass>();
- AU.addPreserved<GlobalsAAWrapperPass>();
- }
-};
-} // namespace
-
-PreservedAnalyses ExpandLargeDivRemPass::run(Function &F,
- FunctionAnalysisManager &FAM) {
- const TargetSubtargetInfo *STI = TM->getSubtargetImpl(F);
- return runImpl(F, *STI->getTargetLowering()) ? PreservedAnalyses::none()
- : PreservedAnalyses::all();
-}
-
-char ExpandLargeDivRemLegacyPass::ID = 0;
-INITIALIZE_PASS_BEGIN(ExpandLargeDivRemLegacyPass, "expand-large-div-rem",
- "Expand large div/rem", false, false)
-INITIALIZE_PASS_END(ExpandLargeDivRemLegacyPass, "expand-large-div-rem",
- "Expand large div/rem", false, false)
-
-FunctionPass *llvm::createExpandLargeDivRemPass() {
- return new ExpandLargeDivRemLegacyPass();
-}
diff --git a/llvm/lib/CodeGen/TargetPassConfig.cpp b/llvm/lib/CodeGen/TargetPassConfig.cpp
index 120343d4b349b..acceb66468409 100644
--- a/llvm/lib/CodeGen/TargetPassConfig.cpp
+++ b/llvm/lib/CodeGen/TargetPassConfig.cpp
@@ -1090,7 +1090,6 @@ bool TargetPassConfig::addISelPasses() {
PM->add(createTargetTransformInfoWrapperPass(TM->getTargetIRAnalysis()));
addPass(createPreISelIntrinsicLoweringPass());
- addPass(createExpandLargeDivRemPass());
addPass(createExpandFpPass(getOptLevel()));
addIRPasses();
addCodeGenPrepare();
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index f5281ea69b512..d639c24664ad1 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -92,7 +92,6 @@
#include "llvm/CodeGen/EarlyIfConversion.h"
#include "llvm/CodeGen/EdgeBundles.h"
#include "llvm/CodeGen/ExpandFp.h"
-#include "llvm/CodeGen/ExpandLargeDivRem.h"
#include "llvm/CodeGen/ExpandMemCmp.h"
#include "llvm/CodeGen/ExpandPostRAPseudos.h"
#include "llvm/CodeGen/ExpandReductions.h"
diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def
index cf998f29ef38c..14215bb32e777 100644
--- a/llvm/lib/Passes/PassRegistry.def
+++ b/llvm/lib/Passes/PassRegistry.def
@@ -433,7 +433,6 @@ FUNCTION_PASS("dot-post-dom", PostDomPrinter())
FUNCTION_PASS("dot-post-dom-only", PostDomOnlyPrinter())
FUNCTION_PASS("dse", DSEPass())
FUNCTION_PASS("dwarf-eh-prepare", DwarfEHPreparePass(*TM))
-FUNCTION_PASS("expand-large-div-rem", ExpandLargeDivRemPass(*TM))
FUNCTION_PASS("expand-memcmp", ExpandMemCmpPass(*TM))
FUNCTION_PASS("expand-reductions", ExpandReductionsPass())
FUNCTION_PASS("extra-vector-passes",
diff --git a/llvm/test/CodeGen/AArch64/O0-pipeline.ll b/llvm/test/CodeGen/AArch64/O0-pipeline.ll
index 96f5e5a4afb3e..2a1264446c70d 100644
--- a/llvm/test/CodeGen/AArch64/O0-pipeline.ll
+++ b/llvm/test/CodeGen/AArch64/O0-pipeline.ll
@@ -17,7 +17,6 @@
; CHECK-NEXT: ModulePass Manager
; CHECK-NEXT: Pre-ISel Intrinsic Lowering
; CHECK-NEXT: FunctionPass Manager
-; CHECK-NEXT: Expand large div/rem
; CHECK-NEXT: Expand fp
; CHECK-NEXT: Expand Atomic instructions
; CHECK-NEXT: Module Verifier
diff --git a/llvm/test/CodeGen/AArch64/O3-pipeline.ll b/llvm/test/CodeGen/AArch64/O3-pipeline.ll
index e8ea55e027aec..4dc3cd1d6b786 100644
--- a/llvm/test/CodeGen/AArch64/O3-pipeline.ll
+++ b/llvm/test/CodeGen/AArch64/O3-pipeline.ll
@@ -21,7 +21,6 @@
; CHECK-NEXT: ModulePass Manager
; CHECK-NEXT: Pre-ISel Intrinsic Lowering
; CHECK-NEXT: FunctionPass Manager
-; CHECK-NEXT: Expand large div/rem
; CHECK-NEXT: Expand fp
; CHECK-NEXT: Expand Atomic instructions
; CHECK-NEXT: SVE intrinsics optimizations
diff --git a/llvm/test/CodeGen/AMDGPU/llc-pipeline-npm.ll b/llvm/test/CodeGen/AMDGPU/llc-pipeline-npm.ll
index c3dc26f3e10e4..edf4b6f26d08e 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...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/172680
More information about the llvm-commits
mailing list