[llvm] [MemProf] Remove context id set from nodes and recompute on demand (PR #94415)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 4 22:19:20 PDT 2024
================
@@ -262,8 +262,70 @@ class CallsiteContextGraph {
// TODO: Should this be a map (from Caller node) for more efficient lookup?
std::vector<std::shared_ptr<ContextEdge>> CallerEdges;
- // The set of IDs for contexts including this node.
- DenseSet<uint32_t> ContextIds;
+ // Get the list of edges from which we can compute allocation information
+ // such as the context ids and allocation type of this node.
+ const std::vector<std::shared_ptr<ContextEdge>> *
+ getEdgesWithAllocInfo() const {
+ // If node has any callees, compute from those, otherwise compute from
+ // callers (i.e. if this is the leaf allocation node).
+ if (!CalleeEdges.empty())
+ return &CalleeEdges;
+ else if (!CallerEdges.empty()) {
----------------
kazutakahirata wrote:
Remove the `else` after `return`.
```suggestion
if (!CallerEdges.empty()) {
```
https://github.com/llvm/llvm-project/pull/94415
More information about the llvm-commits
mailing list