aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/LiveDebugValues.cpp
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2018-10-05 21:44:00 +0000
committerVedant Kumar <vsk@apple.com>2018-10-05 21:44:00 +0000
commit9b558380ddd2796be7dd4e350c2682d4a4862ac8 (patch)
treed903b1948ca2d280e011f4f095fa284860fd4b32 /llvm/lib/CodeGen/LiveDebugValues.cpp
parentc5a0cb846dcbb63f444e0bd23f85c8ddff1ed7a6 (diff)
downloadllvm-9b558380ddd2796be7dd4e350c2682d4a4862ac8.zip
llvm-9b558380ddd2796be7dd4e350c2682d4a4862ac8.tar.gz
llvm-9b558380ddd2796be7dd4e350c2682d4a4862ac8.tar.bz2
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. llvm-svn: 343889
Diffstat (limited to 'llvm/lib/CodeGen/LiveDebugValues.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveDebugValues.cpp34
1 files changed, 27 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/LiveDebugValues.cpp b/llvm/lib/CodeGen/LiveDebugValues.cpp
index fa2cb27..22e6c30 100644
--- a/llvm/lib/CodeGen/LiveDebugValues.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues.cpp
@@ -323,8 +323,10 @@ void LiveDebugValues::printVarLocInMBB(const MachineFunction &MF,
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::transferTerminatorInst(MachineInstr &MI,
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(MachineInstr &MI, OpenRangesSet &OpenRanges,
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(MachineBasicBlock &MBB, VarLocInMBB &OutLocs,
// 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(MachineBasicBlock &MBB, VarLocInMBB &OutLocs,
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