-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[LiveDebugValues][NFC] Remove TargetPassConfig from LDVImpl #131562
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
@llvm/pr-subscribers-debuginfo Author: Akshat Oke (optimisan) ChangesFull diff: https://github.com/llvm/llvm-project/pull/131562.diff 5 Files Affected:
diff --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
index 2510b77c6d5be..d8b163a7453f2 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
@@ -270,12 +270,12 @@ class TransferTracker {
TransferTracker(const TargetInstrInfo *TII, MLocTracker *MTracker,
MachineFunction &MF, const DebugVariableMap &DVMap,
const TargetRegisterInfo &TRI,
- const BitVector &CalleeSavedRegs, const TargetPassConfig &TPC)
+ const BitVector &CalleeSavedRegs,
+ bool ShouldEmitDebugEntryValues)
: TII(TII), MTracker(MTracker), MF(MF), DVMap(DVMap), TRI(TRI),
CalleeSavedRegs(CalleeSavedRegs) {
TLI = MF.getSubtarget().getTargetLowering();
- auto &TM = TPC.getTM<TargetMachine>();
- ShouldEmitDebugEntryValues = TM.Options.ShouldEmitDebugEntryValues();
+ this->ShouldEmitDebugEntryValues = ShouldEmitDebugEntryValues;
}
bool isCalleeSaved(LocIdx L) const {
@@ -3545,9 +3545,9 @@ bool InstrRefBasedLDV::depthFirstVLocAndEmit(
const ScopeToVarsT &ScopeToVars, ScopeToAssignBlocksT &ScopeToAssignBlocks,
LiveInsT &Output, FuncValueTable &MOutLocs, FuncValueTable &MInLocs,
SmallVectorImpl<VLocTracker> &AllTheVLocs, MachineFunction &MF,
- const TargetPassConfig &TPC) {
- TTracker =
- new TransferTracker(TII, MTracker, MF, DVMap, *TRI, CalleeSavedRegs, TPC);
+ bool ShouldEmitDebugEntryValues) {
+ TTracker = new TransferTracker(TII, MTracker, MF, DVMap, *TRI,
+ CalleeSavedRegs, ShouldEmitDebugEntryValues);
unsigned NumLocs = MTracker->getNumLocs();
VTracker = nullptr;
@@ -3690,7 +3690,7 @@ bool InstrRefBasedLDV::emitTransfers() {
/// extend ranges across basic blocks.
bool InstrRefBasedLDV::ExtendRanges(MachineFunction &MF,
MachineDominatorTree *DomTree,
- TargetPassConfig *TPC,
+ bool ShouldEmitDebugEntryValues,
unsigned InputBBLimit,
unsigned InputDbgValLimit) {
// No subprogram means this function contains no debuginfo.
@@ -3698,7 +3698,6 @@ bool InstrRefBasedLDV::ExtendRanges(MachineFunction &MF,
return false;
LLVM_DEBUG(dbgs() << "\nDebug Range Extension\n");
- this->TPC = TPC;
this->DomTree = DomTree;
TRI = MF.getSubtarget().getRegisterInfo();
@@ -3839,7 +3838,7 @@ bool InstrRefBasedLDV::ExtendRanges(MachineFunction &MF,
// the "else" block of this condition.
Changed = depthFirstVLocAndEmit(
MaxNumBlocks, ScopeToDILocation, ScopeToVars, ScopeToAssignBlocks,
- SavedLiveIns, MOutLocs, MInLocs, vlocs, MF, *TPC);
+ SavedLiveIns, MOutLocs, MInLocs, vlocs, MF, ShouldEmitDebugEntryValues);
}
delete MTracker;
diff --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
index 68db65ace9a42..810a71f4d8af4 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
@@ -1160,7 +1160,6 @@ class InstrRefBasedLDV : public LDVImpl {
const MachineFrameInfo *MFI;
BitVector CalleeSavedRegs;
LexicalScopes LS;
- TargetPassConfig *TPC;
// An empty DIExpression. Used default / placeholder DbgValueProperties
// objects, as we can't have null expressions.
@@ -1478,17 +1477,15 @@ class InstrRefBasedLDV : public LDVImpl {
/// block information can be fully computed before exploration finishes,
/// allowing us to emit it and free data structures earlier than otherwise.
/// It's also good for locality.
- bool depthFirstVLocAndEmit(unsigned MaxNumBlocks,
- const ScopeToDILocT &ScopeToDILocation,
- const ScopeToVarsT &ScopeToVars,
- ScopeToAssignBlocksT &ScopeToBlocks,
- LiveInsT &Output, FuncValueTable &MOutLocs,
- FuncValueTable &MInLocs,
- SmallVectorImpl<VLocTracker> &AllTheVLocs,
- MachineFunction &MF, const TargetPassConfig &TPC);
+ bool depthFirstVLocAndEmit(
+ unsigned MaxNumBlocks, const ScopeToDILocT &ScopeToDILocation,
+ const ScopeToVarsT &ScopeToVars, ScopeToAssignBlocksT &ScopeToBlocks,
+ LiveInsT &Output, FuncValueTable &MOutLocs, FuncValueTable &MInLocs,
+ SmallVectorImpl<VLocTracker> &AllTheVLocs, MachineFunction &MF,
+ bool ShouldEmitDebugEntryValues);
bool ExtendRanges(MachineFunction &MF, MachineDominatorTree *DomTree,
- TargetPassConfig *TPC, unsigned InputBBLimit,
+ bool ShouldEmitDebugEntryValues, unsigned InputBBLimit,
unsigned InputDbgValLimit) override;
public:
diff --git a/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp b/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp
index a7f089928f84d..484143a03fca1 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp
@@ -116,8 +116,10 @@ bool LiveDebugValues::runOnMachineFunction(MachineFunction &MF) {
TheImpl = &*InstrRefImpl;
}
- return TheImpl->ExtendRanges(MF, DomTree, TPC, InputBBLimit,
- InputDbgValueLimit);
+ return TheImpl->ExtendRanges(
+ MF, DomTree,
+ TPC->getTM<TargetMachine>().Options.ShouldEmitDebugEntryValues(),
+ InputBBLimit, InputDbgValueLimit);
}
bool llvm::debuginfoShouldUseDebugInstrRef(const Triple &T) {
diff --git a/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.h b/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.h
index 6cc1685c00222..3bbe9ce34b355 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.h
+++ b/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.h
@@ -25,7 +25,8 @@ inline namespace SharedLiveDebugValues {
class LDVImpl {
public:
virtual bool ExtendRanges(MachineFunction &MF, MachineDominatorTree *DomTree,
- TargetPassConfig *TPC, unsigned InputBBLimit,
+ bool ShouldEmitDebugEntryValues,
+ unsigned InputBBLimit,
unsigned InputDbgValLimit) = 0;
virtual ~LDVImpl() = default;
};
diff --git a/llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp
index f7150f96b625d..3089235650e63 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp
@@ -284,7 +284,7 @@ class VarLocBasedLDV : public LDVImpl {
const TargetRegisterInfo *TRI;
const TargetInstrInfo *TII;
const TargetFrameLowering *TFI;
- TargetPassConfig *TPC;
+ bool ShouldEmitDebugEntryValues;
BitVector CalleeSavedRegs;
LexicalScopes LS;
VarLocSet::Allocator Alloc;
@@ -1088,7 +1088,7 @@ class VarLocBasedLDV : public LDVImpl {
void flushPendingLocs(VarLocInMBB &PendingInLocs, VarLocMap &VarLocIDs);
bool ExtendRanges(MachineFunction &MF, MachineDominatorTree *DomTree,
- TargetPassConfig *TPC, unsigned InputBBLimit,
+ bool ShouldEmitDebugEntryValues, unsigned InputBBLimit,
unsigned InputDbgValLimit) override;
public:
@@ -1648,11 +1648,8 @@ void VarLocBasedLDV::transferRegisterDef(MachineInstr &MI,
collectIDsForRegs(KillSet, DeadRegs, OpenRanges.getVarLocs(), VarLocIDs);
OpenRanges.erase(KillSet, VarLocIDs, LocIndex::kUniversalLocation);
- if (TPC) {
- auto &TM = TPC->getTM<TargetMachine>();
- if (TM.Options.ShouldEmitDebugEntryValues())
- emitEntryValues(MI, OpenRanges, VarLocIDs, EntryValTransfers, KillSet);
- }
+ if (ShouldEmitDebugEntryValues)
+ emitEntryValues(MI, OpenRanges, VarLocIDs, EntryValTransfers, KillSet);
}
void VarLocBasedLDV::transferWasmDef(MachineInstr &MI,
@@ -2189,11 +2186,8 @@ void VarLocBasedLDV::recordEntryValue(const MachineInstr &MI,
const DefinedRegsSet &DefinedRegs,
OpenRangesSet &OpenRanges,
VarLocMap &VarLocIDs) {
- if (TPC) {
- auto &TM = TPC->getTM<TargetMachine>();
- if (!TM.Options.ShouldEmitDebugEntryValues())
- return;
- }
+ if (ShouldEmitDebugEntryValues)
+ return;
DebugVariable V(MI.getDebugVariable(), MI.getDebugExpression(),
MI.getDebugLoc()->getInlinedAt());
@@ -2217,7 +2211,8 @@ void VarLocBasedLDV::recordEntryValue(const MachineInstr &MI,
/// extend ranges across basic blocks.
bool VarLocBasedLDV::ExtendRanges(MachineFunction &MF,
MachineDominatorTree *DomTree,
- TargetPassConfig *TPC, unsigned InputBBLimit,
+ bool ShouldEmitDebugEntryValues,
+ unsigned InputBBLimit,
unsigned InputDbgValLimit) {
(void)DomTree;
LLVM_DEBUG(dbgs() << "\nDebug Range Extension: " << MF.getName() << "\n");
@@ -2235,7 +2230,8 @@ bool VarLocBasedLDV::ExtendRanges(MachineFunction &MF,
TII = MF.getSubtarget().getInstrInfo();
TFI = MF.getSubtarget().getFrameLowering();
TFI->getCalleeSaves(MF, CalleeSavedRegs);
- this->TPC = TPC;
+ this->ShouldEmitDebugEntryValues = ShouldEmitDebugEntryValues;
+
LS.initialize(MF);
bool Changed = false;
|
bb1d6f1
to
cd06f54
Compare
Not sure if bot failures are related |
In principle this looks good, there's no other need to pass all these references around, we just need the "entry values enabled" bit. The test failures on CI are consistent with something going wrong though, the fragment of output from dbginfo-entryvals.mir shows no entry-values are generated but the test expects to see them. It's not immediately clear to me where the information goes missing. |
Ah, an elusive exclamatory error |
TPC is only used to access the option
ShouldEmitDebugEntryValues
.