[llvm] [GlobalISel][NFC] Rename GISelKnownBits to GISelValueTracking (PR #133466)

via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 28 09:46:04 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-risc-v

Author: Tim Gymnich (tgymnich)

<details>
<summary>Changes</summary>

- rename `GISelKnownBits` to `GISelValueTracking` to analyze more than just `KnownBits` in the future

---

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


55 Files Affected:

- (modified) llvm/docs/GlobalISel/KnownBits.rst (+6-6) 
- (modified) llvm/include/llvm/CodeGen/GlobalISel/Combiner.h (+2-2) 
- (modified) llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h (+4-7) 
- (modified) llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h (+4-4) 
- (renamed) llvm/include/llvm/CodeGen/GlobalISel/GISelValueTracking.h (+19-24) 
- (modified) llvm/include/llvm/CodeGen/GlobalISel/InstructionSelect.h (+2-2) 
- (modified) llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h (+5-5) 
- (modified) llvm/include/llvm/CodeGen/GlobalISel/Legalizer.h (+2-2) 
- (modified) llvm/include/llvm/CodeGen/GlobalISel/LegalizerHelper.h (+4-4) 
- (modified) llvm/include/llvm/CodeGen/GlobalISel/Utils.h (+2-2) 
- (modified) llvm/include/llvm/CodeGen/TargetLowering.h (+6-8) 
- (modified) llvm/include/llvm/InitializePasses.h (+1-1) 
- (modified) llvm/include/llvm/Target/GlobalISel/Combine.td (+1-1) 
- (modified) llvm/lib/CodeGen/GlobalISel/CMakeLists.txt (+1-1) 
- (modified) llvm/lib/CodeGen/GlobalISel/Combiner.cpp (+3-3) 
- (modified) llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp (+47-46) 
- (renamed) llvm/lib/CodeGen/GlobalISel/GISelValueTracking.cpp (+56-50) 
- (modified) llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp (+6-6) 
- (modified) llvm/lib/CodeGen/GlobalISel/Legalizer.cpp (+9-9) 
- (modified) llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp (+4-4) 
- (modified) llvm/lib/CodeGen/GlobalISel/Utils.cpp (+5-5) 
- (modified) llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp (+5-5) 
- (modified) llvm/lib/Target/AArch64/AArch64Combine.td (+1-1) 
- (modified) llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp (+2-2) 
- (modified) llvm/lib/Target/AArch64/GISel/AArch64O0PreLegalizerCombiner.cpp (+10-10) 
- (modified) llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerCombiner.cpp (+10-10) 
- (modified) llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp (+1-1) 
- (modified) llvm/lib/Target/AArch64/GISel/AArch64PreLegalizerCombiner.cpp (+13-13) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUCombinerHelper.cpp (+2-2) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUCombinerHelper.h (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUGlobalISelUtils.cpp (+6-4) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUGlobalISelUtils.h (+2-2) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp (+3-4) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp (+21-20) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.h (+1-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp (+4-4) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUPostLegalizerCombiner.cpp (+15-15) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUPreLegalizerCombiner.cpp (+10-10) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPURegBankCombiner.cpp (+10-10) 
- (modified) llvm/lib/Target/AMDGPU/SIISelLowering.cpp (+19-17) 
- (modified) llvm/lib/Target/AMDGPU/SIISelLowering.h (+3-2) 
- (modified) llvm/lib/Target/Mips/MipsPostLegalizerCombiner.cpp (+10-10) 
- (modified) llvm/lib/Target/Mips/MipsPreLegalizerCombiner.cpp (+11-10) 
- (modified) llvm/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp (+6-6) 
- (modified) llvm/lib/Target/RISCV/GISel/RISCVO0PreLegalizerCombiner.cpp (+10-10) 
- (modified) llvm/lib/Target/RISCV/GISel/RISCVPostLegalizerCombiner.cpp (+11-11) 
- (modified) llvm/lib/Target/RISCV/GISel/RISCVPreLegalizerCombiner.cpp (+10-10) 
- (modified) llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp (+4-3) 
- (modified) llvm/lib/Target/SPIRV/SPIRVPreLegalizer.cpp (+2-2) 
- (modified) llvm/lib/Target/SPIRV/SPIRVPreLegalizerCombiner.cpp (+10-10) 
- (modified) llvm/unittests/CodeGen/GlobalISel/KnownBitsTest.cpp (+72-72) 
- (modified) llvm/unittests/CodeGen/GlobalISel/KnownBitsVectorTest.cpp (+54-54) 
- (modified) llvm/unittests/CodeGen/GlobalISel/LegalizerTest.cpp (+7-7) 
- (modified) llvm/utils/gn/secondary/llvm/lib/CodeGen/GlobalISel/BUILD.gn (+1-1) 


``````````diff
diff --git a/llvm/docs/GlobalISel/KnownBits.rst b/llvm/docs/GlobalISel/KnownBits.rst
index 7e628722d5323..c01faa5f08f0f 100644
--- a/llvm/docs/GlobalISel/KnownBits.rst
+++ b/llvm/docs/GlobalISel/KnownBits.rst
@@ -61,12 +61,12 @@ dependency with ``INITIALIZE_PASS_DEPENDENCY``.
 
 .. code-block:: c++
 
-  #include "llvm/CodeGen/GlobalISel/GISelKnownBits.h"
+  #include "llvm/CodeGen/GlobalISel/GISelValueTracking.h"
 
   ...
 
   INITIALIZE_PASS_BEGIN(...)
-  INITIALIZE_PASS_DEPENDENCY(GISelKnownBitsAnalysis)
+  INITIALIZE_PASS_DEPENDENCY(GISelValueTrackingAnalysis)
   INITIALIZE_PASS_END(...)
 
 and require the pass in ``getAnalysisUsage``.
@@ -74,10 +74,10 @@ and require the pass in ``getAnalysisUsage``.
 .. code-block:: c++
 
   void MyPass::getAnalysisUsage(AnalysisUsage &AU) const {
-    AU.addRequired<GISelKnownBitsAnalysis>();
+    AU.addRequired<GISelValueTrackingAnalysis>();
     // Optional: If your pass preserves known bits analysis (many do) then
     //           indicate that it's preserved for re-use by another pass here.
-    AU.addPreserved<GISelKnownBitsAnalysis>();
+    AU.addPreserved<GISelValueTrackingAnalysis>();
   }
 
 Then it's just a matter of fetching the analysis and using it:
@@ -86,10 +86,10 @@ Then it's just a matter of fetching the analysis and using it:
 
   bool MyPass::runOnMachineFunction(MachineFunction &MF) {
     ...
-    GISelKnownBits &KB = getAnalysis<GISelKnownBitsAnalysis>().get(MF);
+    GISelValueTracking &VT = getAnalysis<GISelValueTrackingAnalysis>().get(MF);
     ...
     MachineInstr *MI = ...;
-    KnownBits Known = KB->getKnownBits(MI->getOperand(0).getReg());
+    KnownBits Known = VT->getKnownBits(MI->getOperand(0).getReg());
     if (Known.Zeros & 1) {
       // Bit 0 is known to be zero
     }
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/Combiner.h b/llvm/include/llvm/CodeGen/GlobalISel/Combiner.h
index fa6a7be6cf6c3..39ff90c2687f4 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/Combiner.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/Combiner.h
@@ -58,7 +58,7 @@ class Combiner : public GIMatchTableExecutor {
   /// If CSEInfo is not null, then the Combiner will use CSEInfo as the observer
   /// and also create a CSEMIRBuilder. Pass nullptr if CSE is not needed.
   Combiner(MachineFunction &MF, CombinerInfo &CInfo,
-           const TargetPassConfig *TPC, GISelKnownBits *KB,
+           const TargetPassConfig *TPC, GISelValueTracking *VT,
            GISelCSEInfo *CSEInfo = nullptr);
   virtual ~Combiner();
 
@@ -72,7 +72,7 @@ class Combiner : public GIMatchTableExecutor {
   MachineIRBuilder &B;
   MachineFunction &MF;
   MachineRegisterInfo &MRI;
-  GISelKnownBits *KB;
+  GISelValueTracking *VT;
 
   const TargetPassConfig *TPC;
   GISelCSEInfo *CSEInfo;
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h b/llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
index 9b78342c8fc39..93b424d27fdf1 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
@@ -38,7 +38,7 @@ class MachineInstrBuilder;
 class MachineRegisterInfo;
 class MachineInstr;
 class MachineOperand;
-class GISelKnownBits;
+class GISelValueTracking;
 class MachineDominatorTree;
 class LegalizerInfo;
 struct LegalityQuery;
@@ -106,7 +106,7 @@ class CombinerHelper {
   MachineIRBuilder &Builder;
   MachineRegisterInfo &MRI;
   GISelChangeObserver &Observer;
-  GISelKnownBits *KB;
+  GISelValueTracking *VT;
   MachineDominatorTree *MDT;
   bool IsPreLegalize;
   const LegalizerInfo *LI;
@@ -115,14 +115,11 @@ class CombinerHelper {
 
 public:
   CombinerHelper(GISelChangeObserver &Observer, MachineIRBuilder &B,
-                 bool IsPreLegalize,
-                 GISelKnownBits *KB = nullptr,
+                 bool IsPreLegalize, GISelValueTracking *VT = nullptr,
                  MachineDominatorTree *MDT = nullptr,
                  const LegalizerInfo *LI = nullptr);
 
-  GISelKnownBits *getKnownBits() const {
-    return KB;
-  }
+  GISelValueTracking *getValueTracking() const { return VT; }
 
   MachineIRBuilder &getBuilder() const {
     return Builder;
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h b/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h
index 073e9a77801cb..6a7c0edbf2ce0 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutor.h
@@ -41,7 +41,7 @@ class MachineBasicBlock;
 class ProfileSummaryInfo;
 class APInt;
 class APFloat;
-class GISelKnownBits;
+class GISelValueTracking;
 class MachineInstr;
 class MachineIRBuilder;
 class MachineInstrBuilder;
@@ -588,7 +588,7 @@ class GIMatchTableExecutor {
   virtual ~GIMatchTableExecutor() = default;
 
   CodeGenCoverage *CoverageInfo = nullptr;
-  GISelKnownBits *KB = nullptr;
+  GISelValueTracking *VT = nullptr;
   MachineFunction *MF = nullptr;
   ProfileSummaryInfo *PSI = nullptr;
   BlockFrequencyInfo *BFI = nullptr;
@@ -598,12 +598,12 @@ class GIMatchTableExecutor {
   virtual void setupGeneratedPerFunctionState(MachineFunction &MF) = 0;
 
   /// Setup per-MF executor state.
-  virtual void setupMF(MachineFunction &mf, GISelKnownBits *kb,
+  virtual void setupMF(MachineFunction &mf, GISelValueTracking *vt,
                        CodeGenCoverage *covinfo = nullptr,
                        ProfileSummaryInfo *psi = nullptr,
                        BlockFrequencyInfo *bfi = nullptr) {
     CoverageInfo = covinfo;
-    KB = kb;
+    VT = vt;
     MF = &mf;
     PSI = psi;
     BFI = bfi;
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/GISelKnownBits.h b/llvm/include/llvm/CodeGen/GlobalISel/GISelValueTracking.h
similarity index 74%
rename from llvm/include/llvm/CodeGen/GlobalISel/GISelKnownBits.h
rename to llvm/include/llvm/CodeGen/GlobalISel/GISelValueTracking.h
index ea75c2c7f6f41..a8c80d8b4598c 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/GISelKnownBits.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/GISelValueTracking.h
@@ -1,4 +1,5 @@
-//===- llvm/CodeGen/GlobalISel/GISelKnownBits.h ---------------*- C++ -*-===//
+//===- llvm/CodeGen/GlobalISel/GISelValueTracking.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.
@@ -11,8 +12,8 @@
 ///
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CODEGEN_GLOBALISEL_GISELKNOWNBITS_H
-#define LLVM_CODEGEN_GLOBALISEL_GISELKNOWNBITS_H
+#ifndef LLVM_CODEGEN_GLOBALISEL_GISELVALUETRACKING_H
+#define LLVM_CODEGEN_GLOBALISEL_GISELVALUETRACKING_H
 
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/CodeGen/GlobalISel/GISelChangeObserver.h"
@@ -26,7 +27,7 @@ namespace llvm {
 class TargetLowering;
 class DataLayout;
 
-class GISelKnownBits : public GISelChangeObserver {
+class GISelValueTracking : public GISelChangeObserver {
   MachineFunction &MF;
   MachineRegisterInfo &MRI;
   const TargetLowering &TL;
@@ -36,23 +37,18 @@ class GISelKnownBits : public GISelChangeObserver {
   SmallDenseMap<Register, KnownBits, 16> ComputeKnownBitsCache;
 
   void computeKnownBitsMin(Register Src0, Register Src1, KnownBits &Known,
-                           const APInt &DemandedElts,
-                           unsigned Depth = 0);
+                           const APInt &DemandedElts, unsigned Depth = 0);
 
   unsigned computeNumSignBitsMin(Register Src0, Register Src1,
                                  const APInt &DemandedElts, unsigned Depth = 0);
 
 public:
-  GISelKnownBits(MachineFunction &MF, unsigned MaxDepth = 6);
-  virtual ~GISelKnownBits() = default;
+  GISelValueTracking(MachineFunction &MF, unsigned MaxDepth = 6);
+  virtual ~GISelValueTracking() = default;
 
-  const MachineFunction &getMachineFunction() const {
-    return MF;
-  }
+  const MachineFunction &getMachineFunction() const { return MF; }
 
-  const DataLayout &getDataLayout() const {
-    return DL;
-  }
+  const DataLayout &getDataLayout() const { return DL; }
 
   virtual void computeKnownBitsImpl(Register R, KnownBits &Known,
                                     const APInt &DemandedElts,
@@ -83,8 +79,7 @@ class GISelKnownBits : public GISelChangeObserver {
   /// predicate to simplify operations downstream.
   bool signBitIsZero(Register Op);
 
-  static void computeKnownBitsForAlignment(KnownBits &Known,
-                                           Align Alignment) {
+  static void computeKnownBitsForAlignment(KnownBits &Known, Align Alignment) {
     // The low bits are known zero if the pointer is aligned.
     Known.Zero.setLowBits(Log2(Alignment));
   }
@@ -103,26 +98,26 @@ class GISelKnownBits : public GISelChangeObserver {
 };
 
 /// To use KnownBitsInfo analysis in a pass,
-/// KnownBitsInfo &Info = getAnalysis<GISelKnownBitsInfoAnalysis>().get(MF);
+/// KnownBitsInfo &Info = getAnalysis<GISelValueTrackingInfoAnalysis>().get(MF);
 /// Add to observer if the Info is caching.
 /// WrapperObserver.addObserver(Info);
 
 /// Eventually add other features such as caching/ser/deserializing
-/// to MIR etc. Those implementations can derive from GISelKnownBits
+/// to MIR etc. Those implementations can derive from GISelValueTracking
 /// and override computeKnownBitsImpl.
-class GISelKnownBitsAnalysis : public MachineFunctionPass {
-  std::unique_ptr<GISelKnownBits> Info;
+class GISelValueTrackingAnalysis : public MachineFunctionPass {
+  std::unique_ptr<GISelValueTracking> Info;
 
 public:
   static char ID;
-  GISelKnownBitsAnalysis() : MachineFunctionPass(ID) {
-    initializeGISelKnownBitsAnalysisPass(*PassRegistry::getPassRegistry());
+  GISelValueTrackingAnalysis() : MachineFunctionPass(ID) {
+    initializeGISelValueTrackingAnalysisPass(*PassRegistry::getPassRegistry());
   }
-  GISelKnownBits &get(MachineFunction &MF);
+  GISelValueTracking &get(MachineFunction &MF);
   void getAnalysisUsage(AnalysisUsage &AU) const override;
   bool runOnMachineFunction(MachineFunction &MF) override;
   void releaseMemory() override { Info.reset(); }
 };
 } // namespace llvm
 
-#endif // LLVM_CODEGEN_GLOBALISEL_GISELKNOWNBITS_H
+#endif // LLVM_CODEGEN_GLOBALISEL_GISELVALUETRACKING_H
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/InstructionSelect.h b/llvm/include/llvm/CodeGen/GlobalISel/InstructionSelect.h
index a2f06e21a700e..75f683764d165 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/InstructionSelect.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/InstructionSelect.h
@@ -21,7 +21,7 @@
 namespace llvm {
 
 class InstructionSelector;
-class GISelKnownBits;
+class GISelValueTracking;
 class BlockFrequencyInfo;
 class ProfileSummaryInfo;
 
@@ -62,7 +62,7 @@ class InstructionSelect : public MachineFunctionPass {
   class MIIteratorMaintainer;
 
   InstructionSelector *ISel = nullptr;
-  GISelKnownBits *KB = nullptr;
+  GISelValueTracking *VT = nullptr;
   BlockFrequencyInfo *BFI = nullptr;
   ProfileSummaryInfo *PSI = nullptr;
 
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h b/llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h
index 0d2ff098a15e3..3712a7fa06d9a 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h
@@ -36,7 +36,7 @@ class LegalizationArtifactCombiner {
   MachineIRBuilder &Builder;
   MachineRegisterInfo &MRI;
   const LegalizerInfo &LI;
-  GISelKnownBits *KB;
+  GISelValueTracking *VT;
 
   static bool isArtifactCast(unsigned Opc) {
     switch (Opc) {
@@ -53,8 +53,8 @@ class LegalizationArtifactCombiner {
 public:
   LegalizationArtifactCombiner(MachineIRBuilder &B, MachineRegisterInfo &MRI,
                                const LegalizerInfo &LI,
-                               GISelKnownBits *KB = nullptr)
-      : Builder(B), MRI(MRI), LI(LI), KB(KB) {}
+                               GISelValueTracking *VT = nullptr)
+      : Builder(B), MRI(MRI), LI(LI), VT(VT) {}
 
   bool tryCombineAnyExt(MachineInstr &MI,
                         SmallVectorImpl<MachineInstr *> &DeadInsts,
@@ -151,7 +151,7 @@ class LegalizationArtifactCombiner {
       // OptLevel results in significant compile-time and O0 code-size
       // improvements. Inserting unnecessary instructions between boolean defs
       // and uses hinders a lot of folding during ISel.
-      if (KB && (KB->getKnownZeroes(AndSrc) | ExtMaskVal).isAllOnes()) {
+      if (VT && (VT->getKnownZeroes(AndSrc) | ExtMaskVal).isAllOnes()) {
         replaceRegOrBuildCopy(DstReg, AndSrc, MRI, Builder, UpdatedDefs,
                               Observer);
       } else {
@@ -214,7 +214,7 @@ class LegalizationArtifactCombiner {
         TruncSrc = Builder.buildAnyExtOrTrunc(DstTy, TruncSrc).getReg(0);
       // Elide G_SEXT_INREG if possible. This is similar to eliding G_AND in
       // tryCombineZExt. Refer to the comment in tryCombineZExt for rationale.
-      if (KB && KB->computeNumSignBits(TruncSrc) >
+      if (VT && VT->computeNumSignBits(TruncSrc) >
                     DstTy.getScalarSizeInBits() - SizeInBits)
         replaceRegOrBuildCopy(DstReg, TruncSrc, MRI, Builder, UpdatedDefs,
                               Observer);
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/Legalizer.h b/llvm/include/llvm/CodeGen/GlobalISel/Legalizer.h
index e232ab0fb3fe5..15bef84632b7a 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/Legalizer.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/Legalizer.h
@@ -22,7 +22,7 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/CodeGen/GlobalISel/GISelKnownBits.h"
+#include "llvm/CodeGen/GlobalISel/GISelValueTracking.h"
 #include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
 
@@ -77,7 +77,7 @@ class Legalizer : public MachineFunctionPass {
   legalizeMachineFunction(MachineFunction &MF, const LegalizerInfo &LI,
                           ArrayRef<GISelChangeObserver *> AuxObservers,
                           LostDebugLocObserver &LocObserver,
-                          MachineIRBuilder &MIRBuilder, GISelKnownBits *KB);
+                          MachineIRBuilder &MIRBuilder, GISelValueTracking *VT);
 };
 } // End namespace llvm.
 
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/LegalizerHelper.h b/llvm/include/llvm/CodeGen/GlobalISel/LegalizerHelper.h
index 4e18f5cc913a7..428f08e5a7b28 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/LegalizerHelper.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/LegalizerHelper.h
@@ -21,7 +21,7 @@
 #define LLVM_CODEGEN_GLOBALISEL_LEGALIZERHELPER_H
 
 #include "llvm/CodeGen/GlobalISel/CallLowering.h"
-#include "llvm/CodeGen/GlobalISel/GISelKnownBits.h"
+#include "llvm/CodeGen/GlobalISel/GISelValueTracking.h"
 #include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
 #include "llvm/CodeGen/RuntimeLibcallUtil.h"
 #include "llvm/CodeGen/TargetOpcodes.h"
@@ -58,7 +58,7 @@ class LegalizerHelper {
   MachineRegisterInfo &MRI;
   const LegalizerInfo &LI;
   const TargetLowering &TLI;
-  GISelKnownBits *KB;
+  GISelValueTracking *VT;
 
 public:
   enum LegalizeResult {
@@ -77,13 +77,13 @@ class LegalizerHelper {
   /// Expose LegalizerInfo so the clients can re-use.
   const LegalizerInfo &getLegalizerInfo() const { return LI; }
   const TargetLowering &getTargetLowering() const { return TLI; }
-  GISelKnownBits *getKnownBits() const { return KB; }
+  GISelValueTracking *getValueTracking() const { return VT; }
 
   LegalizerHelper(MachineFunction &MF, GISelChangeObserver &Observer,
                   MachineIRBuilder &B);
   LegalizerHelper(MachineFunction &MF, const LegalizerInfo &LI,
                   GISelChangeObserver &Observer, MachineIRBuilder &B,
-                  GISelKnownBits *KB = nullptr);
+                  GISelValueTracking *VT = nullptr);
 
   /// Replace \p MI by a sequence of legal instructions that can implement the
   /// same operation. Note that this means \p MI may be deleted, so any iterator
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/Utils.h b/llvm/include/llvm/CodeGen/GlobalISel/Utils.h
index a35ecae5d18bf..44141844f42f4 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/Utils.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/Utils.h
@@ -31,7 +31,7 @@ class AnalysisUsage;
 class LostDebugLocObserver;
 class MachineBasicBlock;
 class BlockFrequencyInfo;
-class GISelKnownBits;
+class GISelValueTracking;
 class MachineFunction;
 class MachineInstr;
 class MachineIRBuilder;
@@ -331,7 +331,7 @@ ConstantFoldICmp(unsigned Pred, const Register Op1, const Register Op2,
 /// from computeKnownBits in that it doesn't necessarily determine which bit is
 /// set.
 bool isKnownToBeAPowerOfTwo(Register Val, const MachineRegisterInfo &MRI,
-                            GISelKnownBits *KnownBits = nullptr);
+                            GISelValueTracking *ValueTracking = nullptr);
 
 /// Returns true if \p Val can be assumed to never be a NaN. If \p SNaN is true,
 /// this returns if \p Val can be assumed to never be a signaling NaN.
diff --git a/llvm/include/llvm/CodeGen/TargetLowering.h b/llvm/include/llvm/CodeGen/TargetLowering.h
index 58ac87206b9a6..29bf1d467ae0e 100644
--- a/llvm/include/llvm/CodeGen/TargetLowering.h
+++ b/llvm/include/llvm/CodeGen/TargetLowering.h
@@ -73,7 +73,7 @@ class FastISel;
 class FunctionLoweringInfo;
 class GlobalValue;
 class Loop;
-class GISelKnownBits;
+class GISelValueTracking;
 class IntrinsicInst;
 class IRBuilderBase;
 struct KnownBits;
@@ -4159,7 +4159,7 @@ class TargetLowering : public TargetLoweringBase {
   /// or one and return them in the KnownZero/KnownOne bitsets. The DemandedElts
   /// argument allows us to only collect the known bits that are shared by the
   /// requested vector elements. This is for GISel.
-  virtual void computeKnownBitsForTargetInstr(GISelKnownBits &Analysis,
+  virtual void computeKnownBitsForTargetInstr(GISelValueTracking &Analysis,
                                               Register R, KnownBits &Known,
                                               const APInt &DemandedElts,
                                               const MachineRegisterInfo &MRI,
@@ -4169,7 +4169,7 @@ class TargetLowering : public TargetLoweringBase {
   /// typically be inferred from the number of low known 0 bits. However, for a
   /// pointer with a non-integral address space, the alignment value may be
   /// independent from the known low bits.
-  virtual Align computeKnownAlignForTargetInstr(GISelKnownBits &Analysis,
+  virtual Align computeKnownAlignForTargetInstr(GISelValueTracking &Analysis,
                                                 Register R,
                                                 const MachineRegisterInfo &MRI,
                                                 unsigned Depth = 0) const;
@@ -4194,11 +4194,9 @@ class TargetLowering : public TargetLoweringBase {
   /// information about sign bits to GlobalISel combiners. The DemandedElts
   /// argument allows us to only collect the minimum sign bits that are shared
   /// by the requested vector elements.
-  virtual unsigned computeNumSignBitsForTargetInstr(GISelKnownBits &Analysis,
-                                                    Register R,
-                                                    const APInt &DemandedElts,
-                                                    const MachineRegisterInfo &MRI,
-                                                    unsigned Depth = 0) const;
+  virtual unsigned computeNumSignBitsForTargetInstr(
+      GISelValueTracking &Analysis, Register R, const APInt &DemandedElts,
+      const MachineRegisterInfo &MRI, unsigned Depth = 0) const;
 
   /// Attempt to simplify any target nodes based on the demanded vector
   /// elements, returning true on success. Otherwise, analyze the expression and
diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h
index e820277724393..8363fba8b1f3a 100644
--- a/llvm/include/llvm/InitializePasses.h
+++ b/llvm/include/llvm/InitializePasses.h
@@ -152,7 +152,7 @@ void initializeLazyValueInfoWrapperPassPass(PassRegistry &);
 void initializeLegacyLICMPassPass(PassRegistry &);
 void initializeLegalizerPass(PassRegistry &);
 void initializeGISelCSEAnalysisWrapperPassPass(PassRegistry &);
-void initializeGISelKnownBitsAnalysisPass(PassRegistry &);
+void initializeGISelValueTrackingAnalysisPass(PassRegistry &);
 void initializeLiveDebugValuesLegacyPass(PassRegistr...
[truncated]

``````````

</details>


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


More information about the llvm-commits mailing list