mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
[PrintSCC] Fix printing a basic-block without a name
Print a basic-block as an operand to handle the case where it has no name. Differential Revision: https://reviews.llvm.org/D80552
This commit is contained in:
parent
3e899294e4
commit
c0f1b37259
27
test/Other/print-cfg-sccs.ll
Normal file
27
test/Other/print-cfg-sccs.ll
Normal file
@ -0,0 +1,27 @@
|
||||
; RUN: opt -print-cfg-sccs -disable-output < %s 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: SCCs for Function test in PostOrder:
|
||||
; CHECK-NEXT: SCC #1 : %exit,
|
||||
; CHECK-NEXT: SCC #2 : %0,
|
||||
; CHECK-NEXT: SCC #3 : %3,
|
||||
; CHECK-NEXT: SCC #4 : %2, %1,
|
||||
; CHECK-NEXT: SCC #5 : %entry,
|
||||
define void @test(i1 %cond) {
|
||||
entry:
|
||||
br i1 %cond, label %0, label %1
|
||||
|
||||
0:
|
||||
br label %exit
|
||||
|
||||
1:
|
||||
br label %2
|
||||
|
||||
2:
|
||||
br i1 %cond, label %1, label %3
|
||||
|
||||
3:
|
||||
br label %exit
|
||||
|
||||
exit:
|
||||
ret void
|
||||
}
|
@ -76,9 +76,10 @@ bool CFGSCC::runOnFunction(Function &F) {
|
||||
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).";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user