[llvm] ff1f3cc - [GISelKnownBits] Make the max depth a parameter of the analysis
Quentin Colombet via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 21 11:35:49 PST 2020
Author: Quentin Colombet
Date: 2020-01-21T11:35:31-08:00
New Revision: ff1f3cc1a12ea252fcc32f467d9f2677c2775bf3
URL: https://github.com/llvm/llvm-project/commit/ff1f3cc1a12ea252fcc32f467d9f2677c2775bf3
DIFF: https://github.com/llvm/llvm-project/commit/ff1f3cc1a12ea252fcc32f467d9f2677c2775bf3.diff
LOG: [GISelKnownBits] Make the max depth a parameter of the analysis
Allow users of that analysis to define the cut off depth of the
analysis instead of hardcoding 6.
NFC as the default parameter is 6.
Added:
Modified:
llvm/include/llvm/CodeGen/GlobalISel/GISelKnownBits.h
llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/GISelKnownBits.h b/llvm/include/llvm/CodeGen/GlobalISel/GISelKnownBits.h
index d44612f54ae5..8c7a7571942b 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/GISelKnownBits.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/GISelKnownBits.h
@@ -31,9 +31,10 @@ class GISelKnownBits : public GISelChangeObserver {
MachineRegisterInfo &MRI;
const TargetLowering &TL;
const DataLayout &DL;
+ unsigned MaxDepth;
public:
- GISelKnownBits(MachineFunction &MF);
+ GISelKnownBits(MachineFunction &MF, unsigned MaxDepth = 6);
virtual ~GISelKnownBits() = default;
void setMF(MachineFunction &MF);
virtual void computeKnownBitsImpl(Register R, KnownBits &Known,
@@ -82,7 +83,7 @@ class GISelKnownBits : public GISelChangeObserver {
void changedInstr(MachineInstr &MI) override{};
protected:
- unsigned getMaxDepth() const { return 6; }
+ unsigned getMaxDepth() const { return MaxDepth; }
};
/// To use KnownBitsInfo analysis in a pass,
diff --git a/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp b/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
index 64023ecfad82..b970f3486798 100644
--- a/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
@@ -24,14 +24,12 @@ using namespace llvm;
char llvm::GISelKnownBitsAnalysis::ID = 0;
-INITIALIZE_PASS_BEGIN(GISelKnownBitsAnalysis, DEBUG_TYPE,
- "Analysis for ComputingKnownBits", false, true)
-INITIALIZE_PASS_END(GISelKnownBitsAnalysis, DEBUG_TYPE,
- "Analysis for ComputingKnownBits", false, true)
+INITIALIZE_PASS(GISelKnownBitsAnalysis, DEBUG_TYPE,
+ "Analysis for ComputingKnownBits", false, true)
-GISelKnownBits::GISelKnownBits(MachineFunction &MF)
+GISelKnownBits::GISelKnownBits(MachineFunction &MF, unsigned MaxDepth)
: MF(MF), MRI(MF.getRegInfo()), TL(*MF.getSubtarget().getTargetLowering()),
- DL(MF.getFunction().getParent()->getDataLayout()) {}
+ DL(MF.getFunction().getParent()->getDataLayout()), MaxDepth(MaxDepth) {}
Align GISelKnownBits::inferAlignmentForFrameIdx(int FrameIdx, int Offset,
const MachineFunction &MF) {
More information about the llvm-commits
mailing list