From f8d10ceafee3976f74ec8acc9d703e687aa09b68 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Wed, 28 Sep 2016 21:34:23 +0000 Subject: [PATCH] Remove dead code from LiveDebugVariables.cpp (NFC) LiveDebugVariables doesn't propagate DBG_VALUEs accross basic block boundaries any more; this functionality was split into LiveDebugValues. We can thus drop the now dead references to LexicalScopes from LiveDebugVariables. llvm-svn: 282638 --- llvm/lib/CodeGen/LiveDebugVariables.cpp | 54 ++++++--------------------------- 1 file changed, 10 insertions(+), 44 deletions(-) diff --git a/llvm/lib/CodeGen/LiveDebugVariables.cpp b/llvm/lib/CodeGen/LiveDebugVariables.cpp index 9753197..0934d8c 100644 --- a/llvm/lib/CodeGen/LiveDebugVariables.cpp +++ b/llvm/lib/CodeGen/LiveDebugVariables.cpp @@ -22,7 +22,6 @@ #include "LiveDebugVariables.h" #include "llvm/ADT/IntervalMap.h" #include "llvm/ADT/Statistic.h" -#include "llvm/CodeGen/LexicalScopes.h" #include "llvm/CodeGen/LiveIntervalAnalysis.h" #include "llvm/CodeGen/MachineDominators.h" #include "llvm/CodeGen/MachineFunction.h" @@ -76,27 +75,6 @@ LiveDebugVariables::LiveDebugVariables() : MachineFunctionPass(ID), pImpl(nullpt /// LocMap - Map of where a user value is live, and its location. typedef IntervalMap LocMap; -namespace { -/// UserValueScopes - Keeps track of lexical scopes associated with a -/// user value's source location. -class UserValueScopes { - DebugLoc DL; - LexicalScopes &LS; - SmallPtrSet LBlocks; - -public: - UserValueScopes(DebugLoc D, LexicalScopes &L) : DL(std::move(D)), LS(L) {} - - /// dominates - Return true if current scope dominates at least one machine - /// instruction in a given machine basic block. - bool dominates(MachineBasicBlock *MBB) { - if (LBlocks.empty()) - LS.getMachineBasicBlocks(DL, LBlocks); - return LBlocks.count(MBB) != 0 || LS.dominates(DL, MBB); - } -}; -} // end anonymous namespace - /// UserValue - 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 @@ -221,8 +199,8 @@ public: I.setValue(getLocationNo(LocMO)); } - /// extendDef - Extend the current definition as far as possible down the - /// dominator tree. Stop when meeting an existing def or when leaving the live + /// extendDef - Extend the current definition as far as possible down. + /// Stop when meeting an existing def or when leaving the live /// range of VNI. /// End points where VNI is no longer live are added to Kills. /// @param Idx Starting point for the definition. @@ -231,12 +209,10 @@ public: /// @param VNI When LR is not null, this is the value to restrict to. /// @param Kills Append end points of VNI's live range to Kills. /// @param LIS Live intervals analysis. - /// @param MDT Dominator tree. void extendDef(SlotIndex Idx, unsigned LocNo, LiveRange *LR, const VNInfo *VNI, SmallVectorImpl *Kills, - LiveIntervals &LIS, MachineDominatorTree &MDT, - UserValueScopes &UVS); + LiveIntervals &LIS); /// addDefsFromCopies - The value in LI/LocNo may be copies to other /// registers. Determine if any of the copies are available at the kill @@ -254,8 +230,7 @@ public: /// computeIntervals - Compute the live intervals of all locations after /// collecting all their def points. void computeIntervals(MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI, - LiveIntervals &LIS, MachineDominatorTree &MDT, - UserValueScopes &UVS); + LiveIntervals &LIS); /// splitRegister - Replace OldReg ranges with NewRegs ranges where NewRegs is /// live. Returns true if any changes were made. @@ -283,8 +258,6 @@ class LDVImpl { LocMap::Allocator allocator; MachineFunction *MF; LiveIntervals *LIS; - LexicalScopes LS; - MachineDominatorTree *MDT; const TargetRegisterInfo *TRI; /// Whether emitDebugValues is called. @@ -342,7 +315,6 @@ public: "Dbg values are not emitted in LDV"); EmitDone = false; ModifiedMF = false; - LS.reset(); } /// mapVirtReg - Map virtual register to an equivalence class. @@ -541,8 +513,7 @@ bool LDVImpl::collectDebugValues(MachineFunction &mf) { /// data-flow analysis to propagate them beyond basic block boundaries. void UserValue::extendDef(SlotIndex Idx, unsigned LocNo, LiveRange *LR, const VNInfo *VNI, SmallVectorImpl *Kills, - LiveIntervals &LIS, MachineDominatorTree &MDT, - UserValueScopes &UVS) { + LiveIntervals &LIS) { SlotIndex Start = Idx; MachineBasicBlock *MBB = LIS.getMBBFromIndex(Start); SlotIndex Stop = LIS.getMBBEndIdx(MBB); @@ -660,9 +631,7 @@ UserValue::addDefsFromCopies(LiveInterval *LI, unsigned LocNo, void UserValue::computeIntervals(MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI, - LiveIntervals &LIS, - MachineDominatorTree &MDT, - UserValueScopes &UVS) { + LiveIntervals &LIS) { SmallVector, 16> Defs; // Collect all defs to be extended (Skipping undefs). @@ -677,7 +646,7 @@ UserValue::computeIntervals(MachineRegisterInfo &MRI, const MachineOperand &Loc = locations[LocNo]; if (!Loc.isReg()) { - extendDef(Idx, LocNo, nullptr, nullptr, nullptr, LIS, MDT, UVS); + extendDef(Idx, LocNo, nullptr, nullptr, nullptr, LIS); continue; } @@ -690,7 +659,7 @@ UserValue::computeIntervals(MachineRegisterInfo &MRI, VNI = LI->getVNInfoAt(Idx); } SmallVector Kills; - extendDef(Idx, LocNo, LI, VNI, &Kills, LIS, MDT, UVS); + extendDef(Idx, LocNo, LI, VNI, &Kills, LIS); if (LI) addDefsFromCopies(LI, LocNo, Kills, Defs, MRI, LIS); continue; @@ -701,7 +670,7 @@ UserValue::computeIntervals(MachineRegisterInfo &MRI, LiveRange *LR = &LIS.getRegUnit(Unit); const VNInfo *VNI = LR->getVNInfoAt(Idx); // Don't track copies from physregs, it is too expensive. - extendDef(Idx, LocNo, LR, VNI, nullptr, LIS, MDT, UVS); + extendDef(Idx, LocNo, LR, VNI, nullptr, LIS); } // Finally, erase all the undefs. @@ -714,8 +683,7 @@ UserValue::computeIntervals(MachineRegisterInfo &MRI, void LDVImpl::computeIntervals() { for (unsigned i = 0, e = userValues.size(); i != e; ++i) { - UserValueScopes UVS(userValues[i]->getDebugLoc(), LS); - userValues[i]->computeIntervals(MF->getRegInfo(), *TRI, *LIS, *MDT, UVS); + userValues[i]->computeIntervals(MF->getRegInfo(), *TRI, *LIS); userValues[i]->mapVirtRegs(this); } } @@ -724,9 +692,7 @@ bool LDVImpl::runOnMachineFunction(MachineFunction &mf) { clear(); MF = &mf; LIS = &pass.getAnalysis(); - MDT = &pass.getAnalysis(); TRI = mf.getSubtarget().getRegisterInfo(); - LS.initialize(mf); DEBUG(dbgs() << "********** COMPUTING LIVE DEBUG VARIABLES: " << mf.getName() << " **********\n"); -- 2.7.4