diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2022-01-27 22:17:16 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2022-05-14 11:44:34 +0000 |
commit | 04eeddc0aa8e0a417a16eaf9d7d095207f4a8623 (patch) | |
tree | 2a5d3b2fe5c852e91531d128d9177754572d5338 /contrib/llvm-project/llvm/lib/Analysis/LazyCallGraph.cpp | |
parent | 0eae32dcef82f6f06de6419a0d623d7def0cc8f6 (diff) | |
parent | 6f8fc217eaa12bf657be1c6468ed9938d10168b3 (diff) |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Analysis/LazyCallGraph.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/Analysis/LazyCallGraph.cpp | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/contrib/llvm-project/llvm/lib/Analysis/LazyCallGraph.cpp b/contrib/llvm-project/llvm/lib/Analysis/LazyCallGraph.cpp index 0007c54b16d0..e8e9593d7030 100644 --- a/contrib/llvm-project/llvm/lib/Analysis/LazyCallGraph.cpp +++ b/contrib/llvm-project/llvm/lib/Analysis/LazyCallGraph.cpp @@ -1503,7 +1503,7 @@ void LazyCallGraph::removeEdge(Node &SourceN, Node &TargetN) { void LazyCallGraph::removeDeadFunction(Function &F) { // FIXME: This is unnecessarily restrictive. We should be able to remove // functions which recursively call themselves. - assert(F.use_empty() && + assert(F.hasZeroLiveUses() && "This routine should only be called on trivially dead functions!"); // We shouldn't remove library functions as they are never really dead while @@ -1522,13 +1522,6 @@ void LazyCallGraph::removeDeadFunction(Function &F) { // Remove this from the entry edges if present. EntryEdges.removeEdgeInternal(N); - if (SCCMap.empty()) { - // No SCCs have been formed, so removing this is fine and there is nothing - // else necessary at this point but clearing out the node. - N.clear(); - return; - } - // Cannot remove a function which has yet to be visited in the DFS walk, so // if we have a node at all then we must have an SCC and RefSCC. auto CI = SCCMap.find(&N); @@ -1544,15 +1537,9 @@ void LazyCallGraph::removeDeadFunction(Function &F) { assert(C.size() == 1 && "Dead functions must be in a singular SCC"); assert(RC.size() == 1 && "Dead functions must be in a singular RefSCC"); - auto RCIndexI = RefSCCIndices.find(&RC); - int RCIndex = RCIndexI->second; - PostOrderRefSCCs.erase(PostOrderRefSCCs.begin() + RCIndex); - RefSCCIndices.erase(RCIndexI); - for (int i = RCIndex, Size = PostOrderRefSCCs.size(); i < Size; ++i) - RefSCCIndices[PostOrderRefSCCs[i]] = i; - // Finally clear out all the data structures from the node down through the - // components. + // components. postorder_ref_scc_iterator will skip empty RefSCCs, so no need + // to adjust LazyCallGraph data structures. N.clear(); N.G = nullptr; N.F = nullptr; |