Revert " [LoongArch][ISel] Check the number of sign bits in `PatGprGpr_32` (#107432)"
[llvm-project.git] / llvm / lib / Analysis / CFGSCCPrinter.cpp
blob24495eba10dac10ff7cdb676abf1682e55414668
1 //===- CFGSCCPrinter.cpp --------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "llvm/Analysis/CFGSCCPrinter.h"
10 #include "llvm/ADT/SCCIterator.h"
11 #include "llvm/IR/CFG.h"
13 using namespace llvm;
15 PreservedAnalyses CFGSCCPrinterPass::run(Function &F,
16 FunctionAnalysisManager &AM) {
17 unsigned SccNum = 0;
18 OS << "SCCs for Function " << F.getName() << " in PostOrder:";
19 for (scc_iterator<Function *> SCCI = scc_begin(&F); !SCCI.isAtEnd(); ++SCCI) {
20 const std::vector<BasicBlock *> &NextSCC = *SCCI;
21 OS << "\nSCC #" << ++SccNum << ": ";
22 bool First = true;
23 for (BasicBlock *BB : NextSCC) {
24 if (First)
25 First = false;
26 else
27 OS << ", ";
28 BB->printAsOperand(OS, false);
30 if (NextSCC.size() == 1 && SCCI.hasCycle())
31 OS << " (Has self-loop).";
33 OS << "\n";
35 return PreservedAnalyses::all();