diff options
Diffstat (limited to 'src/passes/Heap2Local.cpp')
-rw-r--r-- | src/passes/Heap2Local.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/passes/Heap2Local.cpp b/src/passes/Heap2Local.cpp index 82a5e90bb..09a50eea8 100644 --- a/src/passes/Heap2Local.cpp +++ b/src/passes/Heap2Local.cpp @@ -198,15 +198,17 @@ enum class ParentChildInteraction : int8_t { struct EscapeAnalyzer { // To find what escapes, we need to follow where values flow, both up to // parents, and via branches, and through locals. - // TODO: for efficiency, only scan reference types in LocalGraph - const LocalGraph& localGraph; + // + // We use a lazy graph here because we only need this for reference locals, + // and even among them, only ones we see an allocation is stored to. + const LazyLocalGraph& localGraph; const Parents& parents; const BranchUtils::BranchTargets& branchTargets; const PassOptions& passOptions; Module& wasm; - EscapeAnalyzer(const LocalGraph& localGraph, + EscapeAnalyzer(const LazyLocalGraph& localGraph, const Parents& parents, const BranchUtils::BranchTargets& branchTargets, const PassOptions& passOptions, @@ -1139,17 +1141,13 @@ struct Heap2Local { Module& wasm; const PassOptions& passOptions; - // TODO: construct this LocalGraph on demand - LocalGraph localGraph; + LazyLocalGraph localGraph; Parents parents; BranchUtils::BranchTargets branchTargets; Heap2Local(Function* func, Module& wasm, const PassOptions& passOptions) : func(func), wasm(wasm), passOptions(passOptions), localGraph(func, &wasm), parents(func->body), branchTargets(func->body) { - // We need to track what each set influences, to see where its value can - // flow to. - localGraph.computeSetInfluences(); // Find all the relevant allocations in the function: StructNew, ArrayNew, // ArrayNewFixed. |