[PATCH] D80552: [PrintSCC] Fix printing a basic-block without a name
Ehud Katz via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 26 06:27:31 PDT 2020
ekatz created this revision.
ekatz added reviewers: chandlerc, baziotis, dexonsmith.
ekatz added a project: LLVM.
Herald added a subscriber: llvm-commits.
Print a basic-block as an operand to handle the case where it has no name.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D80552
Files:
llvm/tools/opt/PrintSCC.cpp
Index: llvm/tools/opt/PrintSCC.cpp
===================================================================
--- llvm/tools/opt/PrintSCC.cpp
+++ llvm/tools/opt/PrintSCC.cpp
@@ -76,9 +76,10 @@
for (scc_iterator<Function*> SCCI = scc_begin(&F); !SCCI.isAtEnd(); ++SCCI) {
const std::vector<BasicBlock *> &nextSCC = *SCCI;
errs() << "\nSCC #" << ++sccNum << " : ";
- for (std::vector<BasicBlock*>::const_iterator I = nextSCC.begin(),
- E = nextSCC.end(); I != E; ++I)
- errs() << (*I)->getName() << ", ";
+ for (BasicBlock *BB : nextSCC) {
+ BB->printAsOperand(errs(), false);
+ errs() << ", ";
+ }
if (nextSCC.size() == 1 && SCCI.hasCycle())
errs() << " (Has self-loop).";
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80552.266185.patch
Type: text/x-patch
Size: 729 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200526/67975841/attachment.bin>
More information about the llvm-commits
mailing list