[llvm] r290162 - [PM] Rework a loop in the CGSCC update logic to be more conservative and
Chandler Carruth via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 19 19:32:18 PST 2016
Author: chandlerc
Date: Mon Dec 19 21:32:17 2016
New Revision: 290162
URL: http://llvm.org/viewvc/llvm-project?rev=290162&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/Analysis/CGSCCPassManager.cpp
Modified: llvm/trunk/lib/Analysis/CGSCCPassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/CGSCCPassManager.cpp?rev=290162&r1=290161&r2=290162&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/CGSCCPassManager.cpp (original)
+++ llvm/trunk/lib/Analysis/CGSCCPassManager.cpp Mon Dec 19 21:32:17 2016
@@ -329,13 +329,17 @@ LazyCallGraph::SCC &llvm::updateCGAndAna
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";
+ }
}
}
More information about the llvm-commits
mailing list