diff options
author | Akshat Oke <Akshat.Oke@amd.com> | 2024-12-04 14:31:34 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-04 14:31:34 +0530 |
commit | d9b4bdbff597d0ed98dd82674e456ac4c751a6a0 (patch) | |
tree | 8c51157549645ed22100acb0a340d15208135786 /llvm/lib | |
parent | 3b0cb8979624bc052587712650bfd52f77eb69d3 (diff) | |
download | llvm-d9b4bdbff597d0ed98dd82674e456ac4c751a6a0.zip llvm-d9b4bdbff597d0ed98dd82674e456ac4c751a6a0.tar.gz llvm-d9b4bdbff597d0ed98dd82674e456ac4c751a6a0.tar.bz2 |
[CodeGen][NewPM] Port LiveDebugVariables to NPM (#115468)
The existing analysis was already a pimpl wrapper.
I have extracted legacy pass logic to a LDVImpl wrapper named
`LiveDebugVariables` which is the analysis::Result now. This controls
whether to activate the LDV (depending on `-live-debug-variables` and
DIsubprogram) itself.
The legacy and new analysis only construct the LiveDebugVariables.
VirtRegRewriter will test this.
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/CodeGen.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/CodeGen/LiveDebugVariables.cpp | 172 | ||||
-rw-r--r-- | llvm/lib/CodeGen/RegAllocBasic.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/CodeGen/RegAllocGreedy.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/CodeGen/RegAllocGreedy.h | 3 | ||||
-rw-r--r-- | llvm/lib/CodeGen/StackSlotColoring.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/CodeGen/VirtRegMap.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/Passes/PassBuilder.cpp | 1 | ||||
-rw-r--r-- | llvm/lib/Target/LoongArch/LoongArchDeadRegisterDefinitions.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Target/RISCV/RISCVDeadRegisterDefinitions.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp | 2 |
11 files changed, 130 insertions, 78 deletions
diff --git a/llvm/lib/CodeGen/CodeGen.cpp b/llvm/lib/CodeGen/CodeGen.cpp index 408395f..5942881 100644 --- a/llvm/lib/CodeGen/CodeGen.cpp +++ b/llvm/lib/CodeGen/CodeGen.cpp @@ -59,7 +59,7 @@ void llvm::initializeCodeGen(PassRegistry &Registry) { initializeInterleavedAccessPass(Registry); initializeJMCInstrumenterPass(Registry); initializeLiveDebugValuesPass(Registry); - initializeLiveDebugVariablesPass(Registry); + initializeLiveDebugVariablesWrapperLegacyPass(Registry); initializeLiveIntervalsWrapperPassPass(Registry); initializeLiveRangeShrinkPass(Registry); initializeLiveStacksPass(Registry); diff --git a/llvm/lib/CodeGen/LiveDebugVariables.cpp b/llvm/lib/CodeGen/LiveDebugVariables.cpp index 2ff346d..317d340 100644 --- a/llvm/lib/CodeGen/LiveDebugVariables.cpp +++ b/llvm/lib/CodeGen/LiveDebugVariables.cpp @@ -38,6 +38,7 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineOperand.h" +#include "llvm/CodeGen/MachinePassManager.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/SlotIndexes.h" #include "llvm/CodeGen/TargetInstrInfo.h" @@ -74,24 +75,27 @@ EnableLDV("live-debug-variables", cl::init(true), STATISTIC(NumInsertedDebugValues, "Number of DBG_VALUEs inserted"); STATISTIC(NumInsertedDebugLabels, "Number of DBG_LABELs inserted"); -char LiveDebugVariables::ID = 0; +char LiveDebugVariablesWrapperLegacy::ID = 0; -INITIALIZE_PASS_BEGIN(LiveDebugVariables, DEBUG_TYPE, - "Debug Variable Analysis", false, false) +INITIALIZE_PASS_BEGIN(LiveDebugVariablesWrapperLegacy, DEBUG_TYPE, + "Debug Variable Analysis", false, false) INITIALIZE_PASS_DEPENDENCY(MachineDominatorTreeWrapperPass) INITIALIZE_PASS_DEPENDENCY(LiveIntervalsWrapperPass) -INITIALIZE_PASS_END(LiveDebugVariables, DEBUG_TYPE, - "Debug Variable Analysis", false, false) +INITIALIZE_PASS_END(LiveDebugVariablesWrapperLegacy, DEBUG_TYPE, + "Debug Variable Analysis", false, false) -void LiveDebugVariables::getAnalysisUsage(AnalysisUsage &AU) const { +void LiveDebugVariablesWrapperLegacy::getAnalysisUsage( + AnalysisUsage &AU) const { AU.addRequired<MachineDominatorTreeWrapperPass>(); AU.addRequiredTransitive<LiveIntervalsWrapperPass>(); AU.setPreservesAll(); MachineFunctionPass::getAnalysisUsage(AU); } -LiveDebugVariables::LiveDebugVariables() : MachineFunctionPass(ID) { - initializeLiveDebugVariablesPass(*PassRegistry::getPassRegistry()); +LiveDebugVariablesWrapperLegacy::LiveDebugVariablesWrapperLegacy() + : MachineFunctionPass(ID) { + initializeLiveDebugVariablesWrapperLegacyPass( + *PassRegistry::getPassRegistry()); } enum : unsigned { UndefLocNo = ~0U }; @@ -274,8 +278,6 @@ using BlockSkipInstsMap = namespace { -class LDVImpl; - /// A user value is a part of a debug info user variable. /// /// A DBG_VALUE instruction notes that (a sub-register of) a virtual register @@ -285,6 +287,8 @@ class LDVImpl; /// user values are related if they are held by the same virtual register. The /// equivalence class is the transitive closure of that relation. class UserValue { + using LDVImpl = LiveDebugVariables::LDVImpl; + const DILocalVariable *Variable; ///< The debug info variable we are part of. /// The part of the variable we describe. const std::optional<DIExpression::FragmentInfo> Fragment; @@ -528,9 +532,17 @@ public: void print(raw_ostream &, const TargetRegisterInfo *); }; +} // end anonymous namespace + +namespace llvm { + /// Implementation of the LiveDebugVariables pass. -class LDVImpl { - LiveDebugVariables &pass; + +LiveDebugVariables::LiveDebugVariables() = default; +LiveDebugVariables::~LiveDebugVariables() = default; +LiveDebugVariables::LiveDebugVariables(LiveDebugVariables &&) = default; + +class LiveDebugVariables::LDVImpl { LocMap::Allocator allocator; MachineFunction *MF = nullptr; LiveIntervals *LIS; @@ -634,7 +646,7 @@ class LDVImpl { void computeIntervals(); public: - LDVImpl(LiveDebugVariables *ps) : pass(*ps) {} + LDVImpl(LiveIntervals *LIS) : LIS(LIS) {} bool runOnMachineFunction(MachineFunction &mf, bool InstrRef); @@ -671,9 +683,8 @@ public: void print(raw_ostream&); }; -} // end anonymous namespace +} // namespace llvm -#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) static void printDebugLoc(const DebugLoc &DL, raw_ostream &CommentOS, const LLVMContext &Ctx) { if (!DL) @@ -753,7 +764,7 @@ void UserLabel::print(raw_ostream &OS, const TargetRegisterInfo *TRI) { OS << '\n'; } -void LDVImpl::print(raw_ostream &OS) { +void LiveDebugVariables::LDVImpl::print(raw_ostream &OS) { OS << "********** DEBUG VARIABLES **********\n"; for (auto &userValue : userValues) userValue->print(OS, TRI); @@ -761,18 +772,16 @@ void LDVImpl::print(raw_ostream &OS) { for (auto &userLabel : userLabels) userLabel->print(OS, TRI); } -#endif -void UserValue::mapVirtRegs(LDVImpl *LDV) { +void UserValue::mapVirtRegs(LiveDebugVariables::LDVImpl *LDV) { for (const MachineOperand &MO : locations) if (MO.isReg() && MO.getReg().isVirtual()) LDV->mapVirtReg(MO.getReg(), this); } -UserValue * -LDVImpl::getUserValue(const DILocalVariable *Var, - std::optional<DIExpression::FragmentInfo> Fragment, - const DebugLoc &DL) { +UserValue *LiveDebugVariables::LDVImpl::getUserValue( + const DILocalVariable *Var, + std::optional<DIExpression::FragmentInfo> Fragment, const DebugLoc &DL) { // FIXME: Handle partially overlapping fragments. See // https://reviews.llvm.org/D70121#1849741. DebugVariable ID(Var, Fragment, DL->getInlinedAt()); @@ -785,19 +794,20 @@ LDVImpl::getUserValue(const DILocalVariable *Var, return UV; } -void LDVImpl::mapVirtReg(Register VirtReg, UserValue *EC) { +void LiveDebugVariables::LDVImpl::mapVirtReg(Register VirtReg, UserValue *EC) { assert(VirtReg.isVirtual() && "Only map VirtRegs"); UserValue *&Leader = virtRegToEqClass[VirtReg]; Leader = UserValue::merge(Leader, EC); } -UserValue *LDVImpl::lookupVirtReg(Register VirtReg) { +UserValue *LiveDebugVariables::LDVImpl::lookupVirtReg(Register VirtReg) { if (UserValue *UV = virtRegToEqClass.lookup(VirtReg)) return UV->getLeader(); return nullptr; } -bool LDVImpl::handleDebugValue(MachineInstr &MI, SlotIndex Idx) { +bool LiveDebugVariables::LDVImpl::handleDebugValue(MachineInstr &MI, + SlotIndex Idx) { // DBG_VALUE loc, offset, variable, expr // DBG_VALUE_LIST variable, expr, locs... if (!MI.isDebugValue()) { @@ -873,8 +883,8 @@ bool LDVImpl::handleDebugValue(MachineInstr &MI, SlotIndex Idx) { return true; } -MachineBasicBlock::iterator LDVImpl::handleDebugInstr(MachineInstr &MI, - SlotIndex Idx) { +MachineBasicBlock::iterator +LiveDebugVariables::LDVImpl::handleDebugInstr(MachineInstr &MI, SlotIndex Idx) { assert(MI.isDebugValueLike() || MI.isDebugPHI()); // In instruction referencing mode, there should be no DBG_VALUE instructions @@ -894,7 +904,8 @@ MachineBasicBlock::iterator LDVImpl::handleDebugInstr(MachineInstr &MI, return NextInst; } -bool LDVImpl::handleDebugLabel(MachineInstr &MI, SlotIndex Idx) { +bool LiveDebugVariables::LDVImpl::handleDebugLabel(MachineInstr &MI, + SlotIndex Idx) { // DBG_LABEL label if (MI.getNumOperands() != 1 || !MI.getOperand(0).isMetadata()) { LLVM_DEBUG(dbgs() << "Can't handle " << MI); @@ -917,7 +928,8 @@ bool LDVImpl::handleDebugLabel(MachineInstr &MI, SlotIndex Idx) { return true; } -bool LDVImpl::collectDebugValues(MachineFunction &mf, bool InstrRef) { +bool LiveDebugVariables::LDVImpl::collectDebugValues(MachineFunction &mf, + bool InstrRef) { bool Changed = false; for (MachineBasicBlock &MBB : mf) { for (MachineBasicBlock::iterator MBBI = MBB.begin(), MBBE = MBB.end(); @@ -1250,7 +1262,7 @@ void UserValue::computeIntervals(MachineRegisterInfo &MRI, I.setStopUnchecked(PrevEnd); } -void LDVImpl::computeIntervals() { +void LiveDebugVariables::LDVImpl::computeIntervals() { LexicalScopes LS; LS.initialize(*MF); @@ -1260,10 +1272,10 @@ void LDVImpl::computeIntervals() { } } -bool LDVImpl::runOnMachineFunction(MachineFunction &mf, bool InstrRef) { +bool LiveDebugVariables::LDVImpl::runOnMachineFunction(MachineFunction &mf, + bool InstrRef) { clear(); MF = &mf; - LIS = &pass.getAnalysis<LiveIntervalsWrapperPass>().getLIS(); TRI = mf.getSubtarget().getRegisterInfo(); LLVM_DEBUG(dbgs() << "********** COMPUTING LIVE DEBUG VARIABLES: " << mf.getName() << " **********\n"); @@ -1298,31 +1310,65 @@ static void removeDebugInstrs(MachineFunction &mf) { } } -bool LiveDebugVariables::runOnMachineFunction(MachineFunction &mf) { - if (!EnableLDV) - return false; - if (!mf.getFunction().getSubprogram()) { - removeDebugInstrs(mf); - return false; - } +bool LiveDebugVariablesWrapperLegacy::runOnMachineFunction( + MachineFunction &mf) { + auto *LIS = &getAnalysis<LiveIntervalsWrapperPass>().getLIS(); - // Have we been asked to track variable locations using instruction - // referencing? - bool InstrRef = mf.useDebugInstrRef(); + Impl = std::make_unique<LiveDebugVariables>(); + Impl->analyze(mf, LIS); + return false; +} - if (!pImpl) - pImpl = new LDVImpl(this); - return static_cast<LDVImpl *>(pImpl)->runOnMachineFunction(mf, InstrRef); +AnalysisKey LiveDebugVariablesAnalysis::Key; + +LiveDebugVariables +LiveDebugVariablesAnalysis::run(MachineFunction &MF, + MachineFunctionAnalysisManager &MFAM) { + MFPropsModifier _(*this, MF); + + auto *LIS = &MFAM.getResult<LiveIntervalsAnalysis>(MF); + LiveDebugVariables LDV; + LDV.analyze(MF, LIS); + return LDV; +} + +PreservedAnalyses +LiveDebugVariablesPrinterPass::run(MachineFunction &MF, + MachineFunctionAnalysisManager &MFAM) { + auto &LDV = MFAM.getResult<LiveDebugVariablesAnalysis>(MF); + LDV.print(OS); + return PreservedAnalyses::all(); } void LiveDebugVariables::releaseMemory() { - if (pImpl) - static_cast<LDVImpl*>(pImpl)->clear(); + if (PImpl) + PImpl->clear(); } -LiveDebugVariables::~LiveDebugVariables() { - if (pImpl) - delete static_cast<LDVImpl*>(pImpl); +bool LiveDebugVariables::invalidate( + MachineFunction &, const PreservedAnalyses &PA, + MachineFunctionAnalysisManager::Invalidator &) { + auto PAC = PA.getChecker<LiveDebugVariablesAnalysis>(); + // Some architectures split the register allocation into multiple phases based + // on register classes. This requires preserving analyses between the phases + // by default. + return !PAC.preservedWhenStateless(); +} + +void LiveDebugVariables::analyze(MachineFunction &MF, LiveIntervals *LIS) { + if (!EnableLDV) + return; + if (!MF.getFunction().getSubprogram()) { + removeDebugInstrs(MF); + return; + } + + PImpl.reset(new LDVImpl(LIS)); + + // Have we been asked to track variable locations using instruction + // referencing? + bool InstrRef = MF.useDebugInstrRef(); + PImpl->runOnMachineFunction(MF, InstrRef); } //===----------------------------------------------------------------------===// @@ -1445,7 +1491,8 @@ UserValue::splitRegister(Register OldReg, ArrayRef<Register> NewRegs, return DidChange; } -void LDVImpl::splitPHIRegister(Register OldReg, ArrayRef<Register> NewRegs) { +void LiveDebugVariables::LDVImpl::splitPHIRegister(Register OldReg, + ArrayRef<Register> NewRegs) { auto RegIt = RegToPHIIdx.find(OldReg); if (RegIt == RegToPHIIdx.end()) return; @@ -1483,7 +1530,8 @@ void LDVImpl::splitPHIRegister(Register OldReg, ArrayRef<Register> NewRegs) { RegToPHIIdx[RegAndInstr.first].push_back(RegAndInstr.second); } -void LDVImpl::splitRegister(Register OldReg, ArrayRef<Register> NewRegs) { +void LiveDebugVariables::LDVImpl::splitRegister(Register OldReg, + ArrayRef<Register> NewRegs) { // Consider whether this split range affects any PHI locations. splitPHIRegister(OldReg, NewRegs); @@ -1504,8 +1552,8 @@ void LDVImpl::splitRegister(Register OldReg, ArrayRef<Register> NewRegs) { void LiveDebugVariables:: splitRegister(Register OldReg, ArrayRef<Register> NewRegs, LiveIntervals &LIS) { - if (pImpl) - static_cast<LDVImpl*>(pImpl)->splitRegister(OldReg, NewRegs); + if (PImpl) + PImpl->splitRegister(OldReg, NewRegs); } void UserValue::rewriteLocations(VirtRegMap &VRM, const MachineFunction &MF, @@ -1807,7 +1855,7 @@ void UserLabel::emitDebugLabel(LiveIntervals &LIS, const TargetInstrInfo &TII, LLVM_DEBUG(dbgs() << '\n'); } -void LDVImpl::emitDebugValues(VirtRegMap *VRM) { +void LiveDebugVariables::LDVImpl::emitDebugValues(VirtRegMap *VRM) { LLVM_DEBUG(dbgs() << "********** EMITTING LIVE DEBUG VARIABLES **********\n"); if (!MF) return; @@ -1956,13 +2004,15 @@ void LDVImpl::emitDebugValues(VirtRegMap *VRM) { } void LiveDebugVariables::emitDebugValues(VirtRegMap *VRM) { - if (pImpl) - static_cast<LDVImpl*>(pImpl)->emitDebugValues(VRM); + if (PImpl) + PImpl->emitDebugValues(VRM); } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) -LLVM_DUMP_METHOD void LiveDebugVariables::dump() const { - if (pImpl) - static_cast<LDVImpl*>(pImpl)->print(dbgs()); -} +LLVM_DUMP_METHOD void LiveDebugVariables::dump() const { print(dbgs()); } #endif + +void LiveDebugVariables::print(raw_ostream &OS) const { + if (PImpl) + PImpl->print(OS); +} diff --git a/llvm/lib/CodeGen/RegAllocBasic.cpp b/llvm/lib/CodeGen/RegAllocBasic.cpp index 55d806e7..7ee24c9 100644 --- a/llvm/lib/CodeGen/RegAllocBasic.cpp +++ b/llvm/lib/CodeGen/RegAllocBasic.cpp @@ -130,7 +130,7 @@ char &llvm::RABasicID = RABasic::ID; INITIALIZE_PASS_BEGIN(RABasic, "regallocbasic", "Basic Register Allocator", false, false) -INITIALIZE_PASS_DEPENDENCY(LiveDebugVariables) +INITIALIZE_PASS_DEPENDENCY(LiveDebugVariablesWrapperLegacy) INITIALIZE_PASS_DEPENDENCY(SlotIndexesWrapperPass) INITIALIZE_PASS_DEPENDENCY(LiveIntervalsWrapperPass) INITIALIZE_PASS_DEPENDENCY(RegisterCoalescer) @@ -180,8 +180,8 @@ void RABasic::getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired<LiveIntervalsWrapperPass>(); AU.addPreserved<LiveIntervalsWrapperPass>(); AU.addPreserved<SlotIndexesWrapperPass>(); - AU.addRequired<LiveDebugVariables>(); - AU.addPreserved<LiveDebugVariables>(); + AU.addRequired<LiveDebugVariablesWrapperLegacy>(); + AU.addPreserved<LiveDebugVariablesWrapperLegacy>(); AU.addRequired<LiveStacks>(); AU.addPreserved<LiveStacks>(); AU.addRequired<ProfileSummaryInfoWrapperPass>(); diff --git a/llvm/lib/CodeGen/RegAllocGreedy.cpp b/llvm/lib/CodeGen/RegAllocGreedy.cpp index d0d2c58..8564fd8 100644 --- a/llvm/lib/CodeGen/RegAllocGreedy.cpp +++ b/llvm/lib/CodeGen/RegAllocGreedy.cpp @@ -151,7 +151,7 @@ char &llvm::RAGreedyID = RAGreedy::ID; INITIALIZE_PASS_BEGIN(RAGreedy, "greedy", "Greedy Register Allocator", false, false) -INITIALIZE_PASS_DEPENDENCY(LiveDebugVariables) +INITIALIZE_PASS_DEPENDENCY(LiveDebugVariablesWrapperLegacy) INITIALIZE_PASS_DEPENDENCY(SlotIndexesWrapperPass) INITIALIZE_PASS_DEPENDENCY(LiveIntervalsWrapperPass) INITIALIZE_PASS_DEPENDENCY(RegisterCoalescer) @@ -204,8 +204,8 @@ void RAGreedy::getAnalysisUsage(AnalysisUsage &AU) const { AU.addPreserved<LiveIntervalsWrapperPass>(); AU.addRequired<SlotIndexesWrapperPass>(); AU.addPreserved<SlotIndexesWrapperPass>(); - AU.addRequired<LiveDebugVariables>(); - AU.addPreserved<LiveDebugVariables>(); + AU.addRequired<LiveDebugVariablesWrapperLegacy>(); + AU.addPreserved<LiveDebugVariablesWrapperLegacy>(); AU.addRequired<LiveStacks>(); AU.addPreserved<LiveStacks>(); AU.addRequired<MachineDominatorTreeWrapperPass>(); @@ -2732,7 +2732,7 @@ bool RAGreedy::runOnMachineFunction(MachineFunction &mf) { Loops = &getAnalysis<MachineLoopInfoWrapperPass>().getLI(); Bundles = &getAnalysis<EdgeBundlesWrapperLegacy>().getEdgeBundles(); SpillPlacer = &getAnalysis<SpillPlacementWrapperLegacy>().getResult(); - DebugVars = &getAnalysis<LiveDebugVariables>(); + DebugVars = &getAnalysis<LiveDebugVariablesWrapperLegacy>().getLDV(); initializeCSRCost(); diff --git a/llvm/lib/CodeGen/RegAllocGreedy.h b/llvm/lib/CodeGen/RegAllocGreedy.h index 9578b8d..594c481 100644 --- a/llvm/lib/CodeGen/RegAllocGreedy.h +++ b/llvm/lib/CodeGen/RegAllocGreedy.h @@ -24,6 +24,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" #include "llvm/CodeGen/CalcSpillWeights.h" +#include "llvm/CodeGen/LiveDebugVariables.h" #include "llvm/CodeGen/LiveInterval.h" #include "llvm/CodeGen/LiveRangeEdit.h" #include "llvm/CodeGen/MachineFunction.h" @@ -42,7 +43,7 @@ namespace llvm { class AllocationOrder; class AnalysisUsage; class EdgeBundles; -class LiveDebugVariables; +class LiveDebugVariablesWrapperLegacy; class LiveIntervals; class LiveRegMatrix; class MachineBasicBlock; diff --git a/llvm/lib/CodeGen/StackSlotColoring.cpp b/llvm/lib/CodeGen/StackSlotColoring.cpp index a1fa266..cdc5306 100644 --- a/llvm/lib/CodeGen/StackSlotColoring.cpp +++ b/llvm/lib/CodeGen/StackSlotColoring.cpp @@ -159,7 +159,7 @@ namespace { // may be invoked multiple times requiring it to save these analyses to be // used by RA later. AU.addPreserved<LiveIntervalsWrapperPass>(); - AU.addPreserved<LiveDebugVariables>(); + AU.addPreserved<LiveDebugVariablesWrapperLegacy>(); MachineFunctionPass::getAnalysisUsage(AU); } diff --git a/llvm/lib/CodeGen/VirtRegMap.cpp b/llvm/lib/CodeGen/VirtRegMap.cpp index 26a1251..2084e68 100644 --- a/llvm/lib/CodeGen/VirtRegMap.cpp +++ b/llvm/lib/CodeGen/VirtRegMap.cpp @@ -251,7 +251,7 @@ INITIALIZE_PASS_BEGIN(VirtRegRewriter, "virtregrewriter", "Virtual Register Rewriter", false, false) INITIALIZE_PASS_DEPENDENCY(SlotIndexesWrapperPass) INITIALIZE_PASS_DEPENDENCY(LiveIntervalsWrapperPass) -INITIALIZE_PASS_DEPENDENCY(LiveDebugVariables) +INITIALIZE_PASS_DEPENDENCY(LiveDebugVariablesWrapperLegacy) INITIALIZE_PASS_DEPENDENCY(LiveRegMatrixWrapperLegacy) INITIALIZE_PASS_DEPENDENCY(LiveStacks) INITIALIZE_PASS_DEPENDENCY(VirtRegMapWrapperLegacy) @@ -264,14 +264,14 @@ void VirtRegRewriter::getAnalysisUsage(AnalysisUsage &AU) const { AU.addPreserved<LiveIntervalsWrapperPass>(); AU.addRequired<SlotIndexesWrapperPass>(); AU.addPreserved<SlotIndexesWrapperPass>(); - AU.addRequired<LiveDebugVariables>(); + AU.addRequired<LiveDebugVariablesWrapperLegacy>(); AU.addRequired<LiveStacks>(); AU.addPreserved<LiveStacks>(); AU.addRequired<VirtRegMapWrapperLegacy>(); AU.addRequired<LiveRegMatrixWrapperLegacy>(); if (!ClearVirtRegs) - AU.addPreserved<LiveDebugVariables>(); + AU.addPreserved<LiveDebugVariablesWrapperLegacy>(); MachineFunctionPass::getAnalysisUsage(AU); } @@ -285,7 +285,7 @@ bool VirtRegRewriter::runOnMachineFunction(MachineFunction &fn) { LIS = &getAnalysis<LiveIntervalsWrapperPass>().getLIS(); LRM = &getAnalysis<LiveRegMatrixWrapperLegacy>().getLRM(); VRM = &getAnalysis<VirtRegMapWrapperLegacy>().getVRM(); - DebugVars = &getAnalysis<LiveDebugVariables>(); + DebugVars = &getAnalysis<LiveDebugVariablesWrapperLegacy>().getLDV(); LLVM_DEBUG(dbgs() << "********** REWRITE VIRTUAL REGISTERS **********\n" << "********** Function: " << MF->getName() << '\n'); LLVM_DEBUG(VRM->dump()); diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index ba52a37..cc9f597 100644 --- a/llvm/lib/Passes/PassBuilder.cpp +++ b/llvm/lib/Passes/PassBuilder.cpp @@ -98,6 +98,7 @@ #include "llvm/CodeGen/InterleavedAccess.h" #include "llvm/CodeGen/InterleavedLoadCombine.h" #include "llvm/CodeGen/JMCInstrumenter.h" +#include "llvm/CodeGen/LiveDebugVariables.h" #include "llvm/CodeGen/LiveIntervals.h" #include "llvm/CodeGen/LiveRegMatrix.h" #include "llvm/CodeGen/LiveVariables.h" diff --git a/llvm/lib/Target/LoongArch/LoongArchDeadRegisterDefinitions.cpp b/llvm/lib/Target/LoongArch/LoongArchDeadRegisterDefinitions.cpp index f0e6837..d682b7d 100644 --- a/llvm/lib/Target/LoongArch/LoongArchDeadRegisterDefinitions.cpp +++ b/llvm/lib/Target/LoongArch/LoongArchDeadRegisterDefinitions.cpp @@ -37,7 +37,7 @@ public: AU.addPreserved<LiveIntervalsWrapperPass>(); AU.addRequired<LiveIntervalsWrapperPass>(); AU.addPreserved<SlotIndexesWrapperPass>(); - AU.addPreserved<LiveDebugVariables>(); + AU.addPreserved<LiveDebugVariablesWrapperLegacy>(); AU.addPreserved<LiveStacks>(); MachineFunctionPass::getAnalysisUsage(AU); } diff --git a/llvm/lib/Target/RISCV/RISCVDeadRegisterDefinitions.cpp b/llvm/lib/Target/RISCV/RISCVDeadRegisterDefinitions.cpp index 4b35f3b..7bcf339 100644 --- a/llvm/lib/Target/RISCV/RISCVDeadRegisterDefinitions.cpp +++ b/llvm/lib/Target/RISCV/RISCVDeadRegisterDefinitions.cpp @@ -37,7 +37,7 @@ public: AU.addPreserved<LiveIntervalsWrapperPass>(); AU.addRequired<LiveIntervalsWrapperPass>(); AU.addPreserved<SlotIndexesWrapperPass>(); - AU.addPreserved<LiveDebugVariables>(); + AU.addPreserved<LiveDebugVariablesWrapperLegacy>(); AU.addPreserved<LiveStacks>(); MachineFunctionPass::getAnalysisUsage(AU); } diff --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp index 421150a..870e393 100644 --- a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp +++ b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp @@ -889,7 +889,7 @@ public: AU.addUsedIfAvailable<LiveIntervalsWrapperPass>(); AU.addPreserved<LiveIntervalsWrapperPass>(); AU.addPreserved<SlotIndexesWrapperPass>(); - AU.addPreserved<LiveDebugVariables>(); + AU.addPreserved<LiveDebugVariablesWrapperLegacy>(); AU.addPreserved<LiveStacks>(); MachineFunctionPass::getAnalysisUsage(AU); |