summaryrefslogtreecommitdiff
path: root/src/passes/MergeLocals.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/passes/MergeLocals.cpp')
-rw-r--r--src/passes/MergeLocals.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/passes/MergeLocals.cpp b/src/passes/MergeLocals.cpp
index 9402e0669..b669c20d3 100644
--- a/src/passes/MergeLocals.cpp
+++ b/src/passes/MergeLocals.cpp
@@ -105,10 +105,16 @@ struct MergeLocals
if (copies.empty()) {
return;
}
- // compute all dependencies
auto* func = getFunction();
+
+ // Compute the local graph. Note that we *cannot* do this lazily, as we want
+ // to read from the original state of the function while we are doing
+ // changes on it. That is, using an eager graph makes a snapshot of the
+ // initial state, which is what we want. If we can avoid that, this pass can
+ // be sped up by around 25%.
LocalGraph preGraph(func, getModule());
preGraph.computeSetInfluences();
+
// optimize each copy
std::unordered_map<LocalSet*, LocalSet*> optimizedToCopy,
optimizedToTrivial;