[llvm] [MemProf] Refactor and clean up edge removal (PR #109188)
Snehasish Kumar via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 18 15:46:51 PDT 2024
================
@@ -920,15 +952,42 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::ContextNode::
Caller->CalleeEdges.push_back(Edge);
}
+template <typename DerivedCCG, typename FuncTy, typename CallTy>
+void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::removeEdgeFromGraph(
+ ContextEdge *Edge, EdgeIter *EI, bool CalleeIter) {
+ assert(!EI || (*EI)->get() == Edge);
+ // Save the Caller and Callee pointers so we can erase Edge from their edge
+ // lists after clearing Edge below. We do the clearing first in case it is
+ // destructed after removing from the edge lists (if those were the last
+ // shared_ptr references to Edge).
+ auto *Callee = Edge->Callee;
+ auto *Caller = Edge->Caller;
+
+ // Make sure the edge fields are emptied/nulled out so we can properly detect
----------------
snehasish wrote:
nit: s/emptied\/nulled/cleared/
https://github.com/llvm/llvm-project/pull/109188
More information about the llvm-commits
mailing list