Skip to content

Commit 6f6666f

Browse files
author
tnowicki
committed
[llvm/llvm-project][Coroutines] Add back getBasicBlockLabel for dumping
1 parent 82610e5 commit 6f6666f

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

llvm/lib/Transforms/Coroutines/CoroFrame.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -209,14 +209,24 @@ class SuspendCrossingInfo {
209209
} // end anonymous namespace
210210

211211
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
212+
static std::string getBasicBlockLabel(const BasicBlock *BB) {
213+
if (BB->hasName())
214+
return BB->getName().str();
215+
216+
std::string S;
217+
raw_string_ostream OS(S);
218+
BB->printAsOperand(OS, false);
219+
return OS.str().substr(1);
220+
}
221+
212222
LLVM_DUMP_METHOD void SuspendCrossingInfo::dump(
213223
StringRef Label, BitVector const &BV,
214224
const ReversePostOrderTraversal<Function *> &RPOT) const {
215225
dbgs() << Label << ":";
216226
for (const BasicBlock *BB : RPOT) {
217227
auto BBNo = Mapping.blockToIndex(BB);
218228
if (BV[BBNo])
219-
dbgs() << " " << BB->getName();
229+
dbgs() << " " << getBasicBlockLabel(BB);
220230
}
221231
dbgs() << "\n";
222232
}
@@ -231,7 +241,7 @@ LLVM_DUMP_METHOD void SuspendCrossingInfo::dump() const {
231241
ReversePostOrderTraversal<Function *> RPOT(F);
232242
for (const BasicBlock *BB : RPOT) {
233243
auto BBNo = Mapping.blockToIndex(BB);
234-
dbgs() << BB->getName() << ":\n";
244+
dbgs() << getBasicBlockLabel(BB) << ":\n";
235245
dump(" Consumes", Block[BBNo].Consumes, RPOT);
236246
dump(" Kills", Block[BBNo].Kills, RPOT);
237247
}
@@ -430,10 +440,7 @@ struct RematGraph {
430440
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
431441
void dump() const {
432442
dbgs() << "Entry (";
433-
if (EntryNode->Node->getParent()->hasName())
434-
dbgs() << EntryNode->Node->getParent()->getName();
435-
else
436-
EntryNode->Node->getParent()->printAsOperand(dbgs(), false);
443+
dbgs() << getBasicBlockLabel(EntryNode->Node->getParent());
437444
dbgs() << ") : " << *EntryNode->Node << "\n";
438445
for (auto &E : Remats) {
439446
dbgs() << *(E.first) << "\n";

0 commit comments

Comments
 (0)