[llvm] r343889 - Clarify debug output in LiveDebugValues
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 5 14:44:00 PDT 2018
Author: vedantk
Date: Fri Oct 5 14:44:00 2018
New Revision: 343889
URL: http://llvm.org/viewvc/llvm-project?rev=343889&view=rev
Log:
Clarify debug output in LiveDebugValues
MachineBasicBlocks often do not have names, so it helps to refer to them
by block number when printing debug messages.
Modified:
llvm/trunk/lib/CodeGen/LiveDebugValues.cpp
Modified: llvm/trunk/lib/CodeGen/LiveDebugValues.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveDebugValues.cpp?rev=343889&r1=343888&r2=343889&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveDebugValues.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveDebugValues.cpp Fri Oct 5 14:44:00 2018
@@ -323,8 +323,10 @@ void LiveDebugValues::printVarLocInMBB(c
raw_ostream &Out) const {
Out << '\n' << msg << '\n';
for (const MachineBasicBlock &BB : MF) {
- const auto &L = V.lookup(&BB);
- Out << "MBB: " << BB.getName() << ":\n";
+ const VarLocSet &L = V.lookup(&BB);
+ if (L.empty())
+ continue;
+ Out << "MBB: " << BB.getNumber() << ":\n";
for (unsigned VLL : L) {
const VarLoc &VL = VarLocIDs[VLL];
Out << " Var: " << VL.Var.getVar()->getName();
@@ -604,7 +606,7 @@ bool LiveDebugValues::transferTerminator
LLVM_DEBUG(for (unsigned ID
: OpenRanges.getVarLocs()) {
// Copy OpenRanges to OutLocs, if not already present.
- dbgs() << "Add to OutLocs: ";
+ dbgs() << "Add to OutLocs in MBB #" << CurMBB->getNumber() << ": ";
VarLocIDs[ID].dump();
});
VarLocSet &VLS = OutLocs[CurMBB];
@@ -634,7 +636,7 @@ bool LiveDebugValues::process(MachineIns
bool LiveDebugValues::join(MachineBasicBlock &MBB, VarLocInMBB &OutLocs,
VarLocInMBB &InLocs, const VarLocMap &VarLocIDs,
SmallPtrSet<const MachineBasicBlock *, 16> &Visited) {
- LLVM_DEBUG(dbgs() << "join MBB: " << MBB.getName() << "\n");
+ LLVM_DEBUG(dbgs() << "join MBB: " << MBB.getNumber() << "\n");
bool Changed = false;
VarLocSet InLocsT; // Temporary incoming locations.
@@ -646,8 +648,11 @@ bool LiveDebugValues::join(MachineBasicB
// Ignore unvisited predecessor blocks. As we are processing
// the blocks in reverse post-order any unvisited block can
// be considered to not remove any incoming values.
- if (!Visited.count(p))
+ if (!Visited.count(p)) {
+ LLVM_DEBUG(dbgs() << " ignoring unvisited pred MBB: " << p->getNumber()
+ << "\n");
continue;
+ }
auto OL = OutLocs.find(p);
// Join is null in case of empty OutLocs from any of the pred.
if (OL == OutLocs.end())
@@ -659,14 +664,29 @@ bool LiveDebugValues::join(MachineBasicB
InLocsT = OL->second;
else
InLocsT &= OL->second;
+
+ LLVM_DEBUG({
+ if (!InLocsT.empty()) {
+ for (auto ID : InLocsT)
+ dbgs() << " gathered candidate incoming var: "
+ << VarLocIDs[ID].Var.getVar()->getName() << "\n";
+ }
+ });
+
NumVisited++;
}
// Filter out DBG_VALUES that are out of scope.
VarLocSet KillSet;
- for (auto ID : InLocsT)
- if (!VarLocIDs[ID].dominates(MBB))
+ for (auto ID : InLocsT) {
+ if (!VarLocIDs[ID].dominates(MBB)) {
KillSet.set(ID);
+ LLVM_DEBUG({
+ auto Name = VarLocIDs[ID].Var.getVar()->getName();
+ dbgs() << " killing " << Name << ", it doesn't dominate MBB\n";
+ });
+ }
+ }
InLocsT.intersectWithComplement(KillSet);
// As we are processing blocks in reverse post-order we
More information about the llvm-commits
mailing list