aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/CGSCCPassManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Analysis/CGSCCPassManager.cpp')
-rw-r--r--llvm/lib/Analysis/CGSCCPassManager.cpp42
1 files changed, 9 insertions, 33 deletions
diff --git a/llvm/lib/Analysis/CGSCCPassManager.cpp b/llvm/lib/Analysis/CGSCCPassManager.cpp
index 8ae5c3d..2ed1d98 100644
--- a/llvm/lib/Analysis/CGSCCPassManager.cpp
+++ b/llvm/lib/Analysis/CGSCCPassManager.cpp
@@ -158,10 +158,12 @@ ModuleToPostOrderCGSCCPassAdaptor::run(Module &M, ModuleAnalysisManager &AM) {
SmallDenseSet<std::pair<LazyCallGraph::Node *, LazyCallGraph::SCC *>, 4>
InlinedInternalEdges;
+ SmallVector<Function *, 4> DeadFunctions;
+
CGSCCUpdateResult UR = {
- RCWorklist, CWorklist, InvalidRefSCCSet,
- InvalidSCCSet, nullptr, PreservedAnalyses::all(),
- InlinedInternalEdges, {}};
+ RCWorklist, CWorklist, InvalidRefSCCSet,
+ InvalidSCCSet, nullptr, PreservedAnalyses::all(),
+ InlinedInternalEdges, DeadFunctions, {}};
// Request PassInstrumentation from analysis manager, will use it to run
// instrumenting callbacks for the passes later.
@@ -340,6 +342,10 @@ ModuleToPostOrderCGSCCPassAdaptor::run(Module &M, ModuleAnalysisManager &AM) {
} while (!RCWorklist.empty());
}
+ CG.removeDeadFunctions(DeadFunctions);
+ for (Function *DeadF : DeadFunctions)
+ DeadF->eraseFromParent();
+
#if defined(EXPENSIVE_CHECKS)
// Verify that the call graph is still valid.
CG.verify();
@@ -1030,36 +1036,6 @@ static LazyCallGraph::SCC &updateCGAndAnalysisManagerForPass(
return true;
});
- // Now do a batch removal of the internal ref edges left.
- auto NewRefSCCs = RC->removeInternalRefEdge(N, DeadTargets);
- if (!NewRefSCCs.empty()) {
- // The old RefSCC is dead, mark it as such.
- UR.InvalidatedRefSCCs.insert(RC);
-
- // Note that we don't bother to invalidate analyses as ref-edge
- // connectivity is not really observable in any way and is intended
- // exclusively to be used for ordering of transforms rather than for
- // analysis conclusions.
-
- // Update RC to the "bottom".
- assert(G.lookupSCC(N) == C && "Changed the SCC when splitting RefSCCs!");
- RC = &C->getOuterRefSCC();
- assert(G.lookupRefSCC(N) == RC && "Failed to update current RefSCC!");
-
- // The RC worklist is in reverse postorder, so we enqueue the new ones in
- // RPO except for the one which contains the source node as that is the
- // "bottom" we will continue processing in the bottom-up walk.
- assert(NewRefSCCs.front() == RC &&
- "New current RefSCC not first in the returned list!");
- for (RefSCC *NewRC : llvm::reverse(llvm::drop_begin(NewRefSCCs))) {
- assert(NewRC != RC && "Should not encounter the current RefSCC further "
- "in the postorder list of new RefSCCs.");
- UR.RCWorklist.insert(NewRC);
- LLVM_DEBUG(dbgs() << "Enqueuing a new RefSCC in the update worklist: "
- << *NewRC << "\n");
- }
- }
-
// Next demote all the call edges that are now ref edges. This helps make
// the SCCs small which should minimize the work below as we don't want to
// form cycles that this would break.