summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2016-12-20 03:32:17 +0000
committerChandler Carruth <chandlerc@gmail.com>2016-12-20 03:32:17 +0000
commit66a9568408c2adea45392a3248fde53d2b64f95e (patch)
tree35c6b116ff9cffdb1f209389897a01d7277dced7
parent1d96311447615133f7c807c6b3f7371c7496a982 (diff)
downloadbcm5719-llvm-66a9568408c2adea45392a3248fde53d2b64f95e.tar.gz
bcm5719-llvm-66a9568408c2adea45392a3248fde53d2b64f95e.zip
[PM] Rework a loop in the CGSCC update logic to be more conservative and
clear. The current RefSCC can occur in exactly one position so we should just enforce that and leverage the property rather than checking for it anywhere. This addresses review comments made on another patch. llvm-svn: 290162
-rw-r--r--llvm/lib/Analysis/CGSCCPassManager.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/llvm/lib/Analysis/CGSCCPassManager.cpp b/llvm/lib/Analysis/CGSCCPassManager.cpp
index b2bee0258d1..5c1485d02de 100644
--- a/llvm/lib/Analysis/CGSCCPassManager.cpp
+++ b/llvm/lib/Analysis/CGSCCPassManager.cpp
@@ -329,13 +329,17 @@ LazyCallGraph::SCC &llvm::updateCGAndAnalysisManagerForFunctionPass(
assert(G.lookupSCC(N) == C && "Changed the SCC when splitting RefSCCs!");
RC = &C->getOuterRefSCC();
assert(G.lookupRefSCC(N) == RC && "Failed to update current RefSCC!");
- for (RefSCC *NewRC : reverse(NewRefSCCs))
- if (NewRC != RC) {
- UR.RCWorklist.insert(NewRC);
- if (DebugLogging)
- dbgs() << "Enqueuing a new RefSCC in the update worklist: "
- << *NewRC << "\n";
- }
+ assert(NewRefSCCs.front() == RC &&
+ "New current RefSCC not first in the returned list!");
+ for (RefSCC *NewRC : reverse(
+ make_range(std::next(NewRefSCCs.begin()), NewRefSCCs.end()))) {
+ 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";
+ }
}
}
OpenPOWER on IntegriCloud