[llvm] [GISel] Drop isGISelCSEEnabled hook (PR #216914)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 17 22:04:41 PDT 2026


https://github.com/boomanaiden154 created https://github.com/llvm/llvm-project/pull/216914

This is not overriden by any target and complicates NewPM porting.


>From 4b1a5d590a9d6599cf557f4cbc4321e1a909cc29 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Tue, 18 Aug 2026 05:04:28 +0000
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.7
---
 llvm/include/llvm/CodeGen/TargetPassConfig.h | 4 ----
 llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp | 2 +-
 llvm/lib/CodeGen/GlobalISel/Legalizer.cpp    | 5 ++---
 llvm/lib/CodeGen/TargetPassConfig.cpp        | 4 ----
 4 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/llvm/include/llvm/CodeGen/TargetPassConfig.h b/llvm/include/llvm/CodeGen/TargetPassConfig.h
index 5e0e641a981f9..92b3d4e04f928 100644
--- a/llvm/include/llvm/CodeGen/TargetPassConfig.h
+++ b/llvm/include/llvm/CodeGen/TargetPassConfig.h
@@ -337,10 +337,6 @@ class LLVM_ABI TargetPassConfig : public ImmutablePass {
   /// when GlobalISel failed and isGlobalISelAbortEnabled is false.
   virtual bool reportDiagnosticWhenGlobalISelFallback() const;
 
-  /// Check whether continuous CSE should be enabled in GISel passes.
-  /// By default, it's enabled for non O0 levels.
-  virtual bool isGISelCSEEnabled() const;
-
   /// Returns the CSEConfig object to use for the current optimization level.
   virtual std::unique_ptr<CSEConfigBase> getCSEConfig() const;
 
diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
index 2461d53978f93..d0d973daa3cd4 100644
--- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -4259,7 +4259,7 @@ bool IRTranslator::runOnMachineFunction(MachineFunction &CurMF) {
 
   bool EnableCSE = EnableCSEInIRTranslator.getNumOccurrences()
                        ? EnableCSEInIRTranslator
-                       : TPC->isGISelCSEEnabled();
+                       : true;
 
   const TargetSubtargetInfo &Subtarget = MF->getSubtarget();
   TLI = Subtarget.getTargetLowering();
diff --git a/llvm/lib/CodeGen/GlobalISel/Legalizer.cpp b/llvm/lib/CodeGen/GlobalISel/Legalizer.cpp
index 711f7a0b5c35b..cf300b77437be 100644
--- a/llvm/lib/CodeGen/GlobalISel/Legalizer.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/Legalizer.cpp
@@ -320,9 +320,8 @@ bool Legalizer::runOnMachineFunction(MachineFunction &MF) {
 
   std::unique_ptr<MachineIRBuilder> MIRBuilder;
   GISelCSEInfo *CSEInfo = nullptr;
-  bool EnableCSE = EnableCSEInLegalizer.getNumOccurrences()
-                       ? EnableCSEInLegalizer
-                       : TPC.isGISelCSEEnabled();
+  bool EnableCSE =
+      EnableCSEInLegalizer.getNumOccurrences() ? EnableCSEInLegalizer : true;
   if (EnableCSE) {
     MIRBuilder = std::make_unique<CSEMIRBuilder>();
     CSEInfo = &Wrapper.get(TPC.getCSEConfig());
diff --git a/llvm/lib/CodeGen/TargetPassConfig.cpp b/llvm/lib/CodeGen/TargetPassConfig.cpp
index f5ea9086f6109..06abd8c378ac8 100644
--- a/llvm/lib/CodeGen/TargetPassConfig.cpp
+++ b/llvm/lib/CodeGen/TargetPassConfig.cpp
@@ -1592,10 +1592,6 @@ bool TargetPassConfig::reportDiagnosticWhenGlobalISelFallback() const {
   return TM->Options.GlobalISelAbort == GlobalISelAbortMode::DisableWithDiag;
 }
 
-bool TargetPassConfig::isGISelCSEEnabled() const {
-  return true;
-}
-
 std::unique_ptr<CSEConfigBase> TargetPassConfig::getCSEConfig() const {
   return std::make_unique<CSEConfigBase>();
 }



More information about the llvm-commits mailing list