[llvm] [AArch64][GlobalISel] Drop unused value tracking from O0 pre-legalizer combiner (NFC) (PR #194826)

via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 29 03:10:13 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-aarch64

Author: Cullen Rhodes (c-rhodes)

<details>
<summary>Changes</summary>

It doesn't improve compile-time, but it isn't necessary and can be removed.

---
Full diff: https://github.com/llvm/llvm-project/pull/194826.diff


5 Files Affected:

- (modified) llvm/lib/Target/AArch64/GISel/AArch64O0PreLegalizerCombiner.cpp (+9-20) 
- (modified) llvm/test/CodeGen/AArch64/GlobalISel/gisel-commandline-option.ll (+1-1) 
- (modified) llvm/test/CodeGen/AArch64/O0-pipeline.ll (-1) 
- (modified) llvm/test/CodeGen/AArch64/O3-pipeline.ll (-1) 
- (modified) llvm/test/Other/print-changed-machine.ll (+1-2) 


``````````diff
diff --git a/llvm/lib/Target/AArch64/GISel/AArch64O0PreLegalizerCombiner.cpp b/llvm/lib/Target/AArch64/GISel/AArch64O0PreLegalizerCombiner.cpp
index 8232514e5b367..3970ac530d633 100644
--- a/llvm/lib/Target/AArch64/GISel/AArch64O0PreLegalizerCombiner.cpp
+++ b/llvm/lib/Target/AArch64/GISel/AArch64O0PreLegalizerCombiner.cpp
@@ -55,8 +55,7 @@ class AArch64O0PreLegalizerCombinerImpl : public Combiner {
 
 public:
   AArch64O0PreLegalizerCombinerImpl(
-      MachineFunction &MF, CombinerInfo &CInfo, GISelValueTracking &VT,
-      GISelCSEInfo *CSEInfo,
+      MachineFunction &MF, CombinerInfo &CInfo, GISelCSEInfo *CSEInfo,
       const AArch64O0PreLegalizerCombinerImplRuleConfig &RuleConfig,
       const AArch64Subtarget &STI, const LibcallLoweringInfo &Libcalls);
 
@@ -77,13 +76,12 @@ class AArch64O0PreLegalizerCombinerImpl : public Combiner {
 #undef GET_GICOMBINER_IMPL
 
 AArch64O0PreLegalizerCombinerImpl::AArch64O0PreLegalizerCombinerImpl(
-    MachineFunction &MF, CombinerInfo &CInfo, GISelValueTracking &VT,
-    GISelCSEInfo *CSEInfo,
+    MachineFunction &MF, CombinerInfo &CInfo, GISelCSEInfo *CSEInfo,
     const AArch64O0PreLegalizerCombinerImplRuleConfig &RuleConfig,
     const AArch64Subtarget &STI, const LibcallLoweringInfo &Libcalls)
-    : Combiner(MF, CInfo, &VT, CSEInfo),
-      Helper(Observer, B, /*IsPreLegalize*/ true, &VT), RuleConfig(RuleConfig),
-      STI(STI), Libcalls(Libcalls),
+    : Combiner(MF, CInfo, /*VT=*/nullptr, CSEInfo),
+      Helper(Observer, B, /*IsPreLegalize*/ true, /*VT=*/nullptr),
+      RuleConfig(RuleConfig), STI(STI), Libcalls(Libcalls),
 #define GET_GICOMBINER_CONSTRUCTOR_INITS
 #include "AArch64GenO0PreLegalizeGICombiner.inc"
 #undef GET_GICOMBINER_CONSTRUCTOR_INITS
@@ -119,8 +117,7 @@ bool AArch64O0PreLegalizerCombinerImpl::tryCombineAll(MachineInstr &MI) const {
 }
 
 bool runCombiner(
-    MachineFunction &MF, GISelValueTracking *VT,
-    const LibcallLoweringInfo &Libcalls,
+    MachineFunction &MF, const LibcallLoweringInfo &Libcalls,
     const AArch64O0PreLegalizerCombinerImplRuleConfig &RuleConfig) {
   const Function &F = MF.getFunction();
   const AArch64Subtarget &ST = MF.getSubtarget<AArch64Subtarget>();
@@ -132,7 +129,7 @@ bool runCombiner(
   // at the cost of possibly missing optimizations. See PR#94291 for details.
   CInfo.MaxIterations = 1;
 
-  AArch64O0PreLegalizerCombinerImpl Impl(MF, CInfo, *VT,
+  AArch64O0PreLegalizerCombinerImpl Impl(MF, CInfo,
                                          /*CSEInfo*/ nullptr, RuleConfig, ST,
                                          Libcalls);
   return Impl.combineMachineInstrs();
@@ -164,8 +161,6 @@ void AArch64O0PreLegalizerCombinerLegacy::getAnalysisUsage(
     AnalysisUsage &AU) const {
   AU.setPreservesCFG();
   getSelectionDAGFallbackAnalysisUsage(AU);
-  AU.addRequired<GISelValueTrackingAnalysisLegacy>();
-  AU.addPreserved<GISelValueTrackingAnalysisLegacy>();
   AU.addRequired<LibcallLoweringInfoWrapper>();
   MachineFunctionPass::getAnalysisUsage(AU);
 }
@@ -182,22 +177,19 @@ bool AArch64O0PreLegalizerCombinerLegacy::runOnMachineFunction(
     return false;
 
   const Function &F = MF.getFunction();
-  GISelValueTracking *VT =
-      &getAnalysis<GISelValueTrackingAnalysisLegacy>().get(MF);
 
   const AArch64Subtarget &ST = MF.getSubtarget<AArch64Subtarget>();
   const LibcallLoweringInfo &Libcalls =
       getAnalysis<LibcallLoweringInfoWrapper>().getLibcallLowering(
           *F.getParent(), ST);
 
-  return runCombiner(MF, VT, Libcalls, RuleConfig);
+  return runCombiner(MF, Libcalls, RuleConfig);
 }
 
 char AArch64O0PreLegalizerCombinerLegacy::ID = 0;
 INITIALIZE_PASS_BEGIN(AArch64O0PreLegalizerCombinerLegacy, DEBUG_TYPE,
                       "Combine AArch64 machine instrs before legalization",
                       false, false)
-INITIALIZE_PASS_DEPENDENCY(GISelValueTrackingAnalysisLegacy)
 INITIALIZE_PASS_DEPENDENCY(GISelCSEAnalysisWrapperPass)
 INITIALIZE_PASS_DEPENDENCY(LibcallLoweringInfoWrapper)
 INITIALIZE_PASS_END(AArch64O0PreLegalizerCombinerLegacy, DEBUG_TYPE,
@@ -223,8 +215,6 @@ AArch64O0PreLegalizerCombinerPass::run(MachineFunction &MF,
   if (MF.getProperties().hasFailedISel())
     return PreservedAnalyses::all();
 
-  GISelValueTracking &VT = MFAM.getResult<GISelValueTrackingAnalysis>(MF);
-
   const AArch64Subtarget &ST = MF.getSubtarget<AArch64Subtarget>();
   auto &MAMProxy =
       MFAM.getResult<ModuleAnalysisManagerMachineFunctionProxy>(MF);
@@ -236,12 +226,11 @@ AArch64O0PreLegalizerCombinerPass::run(MachineFunction &MF,
 
   const LibcallLoweringInfo &Libcalls = LibcallResult->getLibcallLowering(ST);
 
-  if (!runCombiner(MF, &VT, Libcalls, *RuleConfig))
+  if (!runCombiner(MF, Libcalls, *RuleConfig))
     return PreservedAnalyses::all();
 
   PreservedAnalyses PA = getMachineFunctionPassPreservedAnalyses();
   PA.preserveSet<CFGAnalyses>();
-  PA.preserve<GISelValueTrackingAnalysis>();
   return PA;
 }
 
diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/gisel-commandline-option.ll b/llvm/test/CodeGen/AArch64/GlobalISel/gisel-commandline-option.ll
index 3901f99eaa47e..19cd2b5a453f2 100644
--- a/llvm/test/CodeGen/AArch64/GlobalISel/gisel-commandline-option.ll
+++ b/llvm/test/CodeGen/AArch64/GlobalISel/gisel-commandline-option.ll
@@ -58,7 +58,7 @@
 ; ENABLED-O1-NEXT: Function Alias Analysis Results
 ; ENABLED:       IRTranslator
 ; VERIFY-NEXT:   Verify generated machine code
-; ENABLED-NEXT:  Analysis for ComputingKnownBits
+; ENABLED-O1-NEXT:  Analysis for ComputingKnownBits
 ; ENABLED-O1-NEXT:  MachineDominator Tree Construction
 ; ENABLED-O1-NEXT:  Analysis containing CSE Info
 ; ENABLED-O1-NEXT:  PreLegalizerCombiner
diff --git a/llvm/test/CodeGen/AArch64/O0-pipeline.ll b/llvm/test/CodeGen/AArch64/O0-pipeline.ll
index c0918a1949499..b363e11f62811 100644
--- a/llvm/test/CodeGen/AArch64/O0-pipeline.ll
+++ b/llvm/test/CodeGen/AArch64/O0-pipeline.ll
@@ -34,7 +34,6 @@
 ; CHECK-NEXT:       Module Verifier
 ; CHECK-NEXT:       Analysis containing CSE Info
 ; CHECK-NEXT:       IRTranslator
-; CHECK-NEXT:       Analysis for ComputingKnownBits
 ; CHECK-NEXT:       AArch64O0PreLegalizerCombiner
 ; CHECK-NEXT:       Localizer
 ; CHECK-NEXT:       Analysis containing CSE Info
diff --git a/llvm/test/CodeGen/AArch64/O3-pipeline.ll b/llvm/test/CodeGen/AArch64/O3-pipeline.ll
index 546949aa4e209..451b79bfa42eb 100644
--- a/llvm/test/CodeGen/AArch64/O3-pipeline.ll
+++ b/llvm/test/CodeGen/AArch64/O3-pipeline.ll
@@ -115,7 +115,6 @@
 ; CHECK-NEXT:       Basic Alias Analysis (stateless AA impl)
 ; CHECK-NEXT:       Function Alias Analysis Results
 ; CHECK-NEXT:       IRTranslator
-; CHECK-NEXT:       Analysis for ComputingKnownBits
 ; CHECK-NEXT:       AArch64O0PreLegalizerCombiner
 ; CHECK-NEXT:       Localizer
 ; CHECK-NEXT:       Analysis containing CSE Info
diff --git a/llvm/test/Other/print-changed-machine.ll b/llvm/test/Other/print-changed-machine.ll
index 98ba95d8af626..3dea1d7436bc0 100644
--- a/llvm/test/Other/print-changed-machine.ll
+++ b/llvm/test/Other/print-changed-machine.ll
@@ -7,8 +7,7 @@
 ; VERBOSE-NEXT:  Function Live Ins: $w0
 ; VERBOSE-EMPTY:
 ; VERBOSE-NEXT:  bb.1.entry:
-; VERBOSE:       *** IR Dump After Analysis for ComputingKnownBits (gisel-known-bits) on foo omitted because no change ***
-; VERBOSE-NEXT:  *** IR Dump After AArch64O0PreLegalizerCombiner (aarch64-O0-prelegalizer-combiner) on foo omitted because no change ***
+; VERBOSE:       *** IR Dump After AArch64O0PreLegalizerCombiner (aarch64-O0-prelegalizer-combiner) on foo omitted because no change ***
 ; VERBOSE:       *** IR Dump After Legalizer (legalizer) on foo ***
 ; VERBOSE-NEXT:  # Machine code for function foo: IsSSA, TracksLiveness, Legalized
 ; VERBOSE-NEXT:  Function Live Ins: $w0

``````````

</details>


https://github.com/llvm/llvm-project/pull/194826


More information about the llvm-commits mailing list