Commit 21390eab authored by Stefanos Baziotis's avatar Stefanos Baziotis
Browse files

[ADT][NFC] SCCIterator: Change hasLoop() to hasCycle()

parent 1079c68a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -264,7 +264,7 @@ void NoRecursionCheck::check(const MatchFinder::MatchResult &Result) {
  for (llvm::scc_iterator<CallGraph *> SCCI = llvm::scc_begin(&CG),
                                       SCCE = llvm::scc_end(&CG);
       SCCI != SCCE; ++SCCI) {
    if (!SCCI.hasLoop()) // We only care about cycles, not standalone nodes.
    if (!SCCI.hasCycle()) // We only care about cycles, not standalone nodes.
      continue;
    handleSCC(*SCCI);
  }
+4 −4
Original line number Diff line number Diff line
@@ -124,11 +124,11 @@ public:
    return CurrentSCC;
  }

  /// Test if the current SCC has a loop.
  /// Test if the current SCC has a cycle.
  ///
  /// If the SCC has more than one node, this is trivially true.  If not, it may
  /// still contain a loop if the node has an edge back to itself.
  bool hasLoop() const;
  /// still contain a cycle if the node has an edge back to itself.
  bool hasCycle() const;

  /// This informs the \c scc_iterator that the specified \c Old node
  /// has been deleted, and \c New is to be used in its place.
@@ -212,7 +212,7 @@ template <class GraphT, class GT> void scc_iterator<GraphT, GT>::GetNextSCC() {
}

template <class GraphT, class GT>
bool scc_iterator<GraphT, GT>::hasLoop() const {
bool scc_iterator<GraphT, GT>::hasCycle() const {
    assert(!CurrentSCC.empty() && "Dereferencing END SCC iterator!");
    if (CurrentSCC.size() > 1)
      return true;
+1 −1
Original line number Diff line number Diff line
@@ -300,7 +300,7 @@ void ModuleSummaryIndex::dumpSCCs(raw_ostream &O) {
      if (V.getSummaryList().size())
        F = cast<FunctionSummary>(V.getSummaryList().front().get());
      O << " " << (F == nullptr ? "External" : "") << " " << utostr(V.getGUID())
        << (I.hasLoop() ? " (has loop)" : "") << "\n";
        << (I.hasCycle() ? " (has cycle)" : "") << "\n";
    }
    O << "}\n";
  }
+2 −2
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ bool CFGSCC::runOnFunction(Function &F) {
    for (std::vector<BasicBlock*>::const_iterator I = nextSCC.begin(),
           E = nextSCC.end(); I != E; ++I)
      errs() << (*I)->getName() << ", ";
    if (nextSCC.size() == 1 && SCCI.hasLoop())
    if (nextSCC.size() == 1 && SCCI.hasCycle())
      errs() << " (Has self-loop).";
  }
  errs() << "\n";
@@ -101,7 +101,7 @@ bool CallGraphSCC::runOnModule(Module &M) {
           E = nextSCC.end(); I != E; ++I)
      errs() << ((*I)->getFunction() ? (*I)->getFunction()->getName()
                                     : "external node") << ", ";
    if (nextSCC.size() == 1 && SCCI.hasLoop())
    if (nextSCC.size() == 1 && SCCI.hasCycle())
      errs() << " (Has self-loop).";
  }
  errs() << "\n";