summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineBlockPlacement.cpp
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2016-03-02 21:45:13 +0000
committerPhilip Reames <listmail@philipreames.com>2016-03-02 21:45:13 +0000
commitb9688f4382ecf5a74c05858c9b4f4d2181ade0d3 (patch)
tree7acbbd31ac7dd4a9c57a487a369a8268ebc904a8 /llvm/lib/CodeGen/MachineBlockPlacement.cpp
parent7cd3fe7db6c57664b47dbbaf02825caa384116ef (diff)
downloadbcm5719-llvm-b9688f4382ecf5a74c05858c9b4f4d2181ade0d3.tar.gz
bcm5719-llvm-b9688f4382ecf5a74c05858c9b4f4d2181ade0d3.zip
[MBP] Adjust debug output to be more focused and approachable
llvm-svn: 262522
Diffstat (limited to 'llvm/lib/CodeGen/MachineBlockPlacement.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineBlockPlacement.cpp27
1 files changed, 9 insertions, 18 deletions
diff --git a/llvm/lib/CodeGen/MachineBlockPlacement.cpp b/llvm/lib/CodeGen/MachineBlockPlacement.cpp
index 038634aeb6e..4838e6b6cc2 100644
--- a/llvm/lib/CodeGen/MachineBlockPlacement.cpp
+++ b/llvm/lib/CodeGen/MachineBlockPlacement.cpp
@@ -321,18 +321,7 @@ static std::string getBlockName(MachineBasicBlock *BB) {
std::string Result;
raw_string_ostream OS(Result);
OS << "BB#" << BB->getNumber();
- OS << " (derived from LLVM BB '" << BB->getName() << "')";
- OS.flush();
- return Result;
-}
-
-/// \brief Helper to print the number of a MBB.
-///
-/// Only used by debug logging.
-static std::string getBlockNum(MachineBasicBlock *BB) {
- std::string Result;
- raw_string_ostream OS(Result);
- OS << "BB#" << BB->getNumber();
+ OS << " ('" << BB->getName() << "')";
OS.flush();
return Result;
}
@@ -620,15 +609,15 @@ void MachineBlockPlacement::buildChain(
// Zero out LoopPredecessors for the successor we're about to merge in case
// we selected a successor that didn't fit naturally into the CFG.
SuccChain.LoopPredecessors = 0;
- DEBUG(dbgs() << "Merging from " << getBlockNum(BB) << " to "
- << getBlockNum(BestSucc) << "\n");
+ DEBUG(dbgs() << "Merging from " << getBlockName(BB) << " to "
+ << getBlockName(BestSucc) << "\n");
markChainSuccessors(SuccChain, LoopHeaderBB, BlockWorkList, BlockFilter);
Chain.merge(BestSucc, &SuccChain);
BB = *std::prev(Chain.end());
}
DEBUG(dbgs() << "Finished forming chain for header block "
- << getBlockNum(*Chain.begin()) << "\n");
+ << getBlockName(*Chain.begin()) << "\n");
}
/// \brief Find the best loop top block for layout.
@@ -675,8 +664,10 @@ MachineBlockPlacement::findBestLoopTop(MachineLoop &L,
}
// If no direct predecessor is fine, just use the loop header.
- if (!BestPred)
+ if (!BestPred) {
+ DEBUG(dbgs() << " final top unchanged\n");
return L.getHeader();
+ }
// Walk backwards through any straight line of predecessors.
while (BestPred->pred_size() == 1 &&
@@ -975,7 +966,7 @@ void MachineBlockPlacement::rotateLoopWithProfile(
}
}
- DEBUG(dbgs() << "The cost of loop rotation by making " << getBlockNum(*Iter)
+ DEBUG(dbgs() << "The cost of loop rotation by making " << getBlockName(*Iter)
<< " to the top: " << Cost.getFrequency() << "\n");
if (Cost < SmallestRotationCost) {
@@ -985,7 +976,7 @@ void MachineBlockPlacement::rotateLoopWithProfile(
}
if (RotationPos != LoopChain.end()) {
- DEBUG(dbgs() << "Rotate loop by making " << getBlockNum(*RotationPos)
+ DEBUG(dbgs() << "Rotate loop by making " << getBlockName(*RotationPos)
<< " to the top\n");
std::rotate(LoopChain.begin(), RotationPos, LoopChain.end());
}
OpenPOWER on IntegriCloud