diff options
Diffstat (limited to 'lib/Analysis/CGSCCPassManager.cpp')
-rw-r--r-- | lib/Analysis/CGSCCPassManager.cpp | 51 |
1 files changed, 22 insertions, 29 deletions
diff --git a/lib/Analysis/CGSCCPassManager.cpp b/lib/Analysis/CGSCCPassManager.cpp index ce8af755147..46d384922af 100644 --- a/lib/Analysis/CGSCCPassManager.cpp +++ b/lib/Analysis/CGSCCPassManager.cpp @@ -11,6 +11,8 @@ #include "llvm/IR/CallSite.h" #include "llvm/IR/InstIterator.h" +#define DEBUG_TYPE "cgscc" + using namespace llvm; // Explicit template instantiations and specialization defininitions for core @@ -322,8 +324,7 @@ template <typename SCCRangeT> LazyCallGraph::SCC * incorporateNewSCCRange(const SCCRangeT &NewSCCRange, LazyCallGraph &G, LazyCallGraph::Node &N, LazyCallGraph::SCC *C, - CGSCCAnalysisManager &AM, CGSCCUpdateResult &UR, - bool DebugLogging = false) { + CGSCCAnalysisManager &AM, CGSCCUpdateResult &UR) { typedef LazyCallGraph::SCC SCC; if (NewSCCRange.begin() == NewSCCRange.end()) @@ -331,8 +332,7 @@ incorporateNewSCCRange(const SCCRangeT &NewSCCRange, LazyCallGraph &G, // Add the current SCC to the worklist as its shape has changed. UR.CWorklist.insert(C); - if (DebugLogging) - dbgs() << "Enqueuing the existing SCC in the worklist:" << *C << "\n"; + DEBUG(dbgs() << "Enqueuing the existing SCC in the worklist:" << *C << "\n"); SCC *OldC = C; @@ -368,8 +368,7 @@ incorporateNewSCCRange(const SCCRangeT &NewSCCRange, LazyCallGraph &G, assert(C != &NewC && "No need to re-visit the current SCC!"); assert(OldC != &NewC && "Already handled the original SCC!"); UR.CWorklist.insert(&NewC); - if (DebugLogging) - dbgs() << "Enqueuing a newly formed SCC:" << NewC << "\n"; + DEBUG(dbgs() << "Enqueuing a newly formed SCC:" << NewC << "\n"); // Ensure new SCCs' function analyses are updated. if (NeedFAMProxy) @@ -385,7 +384,7 @@ incorporateNewSCCRange(const SCCRangeT &NewSCCRange, LazyCallGraph &G, LazyCallGraph::SCC &llvm::updateCGAndAnalysisManagerForFunctionPass( LazyCallGraph &G, LazyCallGraph::SCC &InitialC, LazyCallGraph::Node &N, - CGSCCAnalysisManager &AM, CGSCCUpdateResult &UR, bool DebugLogging) { + CGSCCAnalysisManager &AM, CGSCCUpdateResult &UR) { typedef LazyCallGraph::Node Node; typedef LazyCallGraph::Edge Edge; typedef LazyCallGraph::SCC SCC; @@ -475,7 +474,7 @@ LazyCallGraph::SCC &llvm::updateCGAndAnalysisManagerForFunctionPass( } else { // Now update the call graph. C = incorporateNewSCCRange(RC->switchInternalEdgeToRef(N, E.getNode()), - G, N, C, AM, UR, DebugLogging); + G, N, C, AM, UR); } } @@ -495,9 +494,8 @@ LazyCallGraph::SCC &llvm::updateCGAndAnalysisManagerForFunctionPass( return false; RC->removeOutgoingEdge(N, *TargetN); - if (DebugLogging) - dbgs() << "Deleting outgoing edge from '" << N - << "' to '" << TargetN << "'\n"; + DEBUG(dbgs() << "Deleting outgoing edge from '" << N + << "' to '" << TargetN << "'\n"); return true; }), DeadTargets.end()); @@ -528,9 +526,8 @@ LazyCallGraph::SCC &llvm::updateCGAndAnalysisManagerForFunctionPass( assert(NewRC != RC && "Should not encounter the current RefSCC further " "in the postorder list of new RefSCCs."); UR.RCWorklist.insert(NewRC); - if (DebugLogging) - dbgs() << "Enqueuing a new RefSCC in the update worklist: " << *NewRC - << "\n"; + DEBUG(dbgs() << "Enqueuing a new RefSCC in the update worklist: " + << *NewRC << "\n"); } } @@ -547,9 +544,8 @@ LazyCallGraph::SCC &llvm::updateCGAndAnalysisManagerForFunctionPass( assert(RC->isAncestorOf(TargetRC) && "Cannot potentially form RefSCC cycles here!"); RC->switchOutgoingEdgeToRef(N, *RefTarget); - if (DebugLogging) - dbgs() << "Switch outgoing call edge to a ref edge from '" << N - << "' to '" << *RefTarget << "'\n"; + DEBUG(dbgs() << "Switch outgoing call edge to a ref edge from '" << N + << "' to '" << *RefTarget << "'\n"); continue; } @@ -563,7 +559,7 @@ LazyCallGraph::SCC &llvm::updateCGAndAnalysisManagerForFunctionPass( // Now update the call graph. C = incorporateNewSCCRange(RC->switchInternalEdgeToRef(N, *RefTarget), G, N, - C, AM, UR, DebugLogging); + C, AM, UR); } // Now promote ref edges into call edges. @@ -577,14 +573,12 @@ LazyCallGraph::SCC &llvm::updateCGAndAnalysisManagerForFunctionPass( assert(RC->isAncestorOf(TargetRC) && "Cannot potentially form RefSCC cycles here!"); RC->switchOutgoingEdgeToCall(N, *CallTarget); - if (DebugLogging) - dbgs() << "Switch outgoing ref edge to a call edge from '" << N - << "' to '" << *CallTarget << "'\n"; + DEBUG(dbgs() << "Switch outgoing ref edge to a call edge from '" << N + << "' to '" << *CallTarget << "'\n"); continue; } - if (DebugLogging) - dbgs() << "Switch an internal ref edge to a call edge from '" << N - << "' to '" << *CallTarget << "'\n"; + DEBUG(dbgs() << "Switch an internal ref edge to a call edge from '" << N + << "' to '" << *CallTarget << "'\n"); // Otherwise we are switching an internal ref edge to a call edge. This // may merge away some SCCs, and we add those to the UpdateResult. We also @@ -647,15 +641,14 @@ LazyCallGraph::SCC &llvm::updateCGAndAnalysisManagerForFunctionPass( // post-order sequence, and may end up observing more precise context to // optimize the current SCC. UR.CWorklist.insert(C); - if (DebugLogging) - dbgs() << "Enqueuing the existing SCC in the worklist: " << *C << "\n"; + DEBUG(dbgs() << "Enqueuing the existing SCC in the worklist: " << *C + << "\n"); // Enqueue in reverse order as we pop off the back of the worklist. for (SCC &MovedC : reverse(make_range(RC->begin() + InitialSCCIndex, RC->begin() + NewSCCIndex))) { UR.CWorklist.insert(&MovedC); - if (DebugLogging) - dbgs() << "Enqueuing a newly earlier in post-order SCC: " << MovedC - << "\n"; + DEBUG(dbgs() << "Enqueuing a newly earlier in post-order SCC: " + << MovedC << "\n"); } } } |