Skip to content

Commit d673f1b

Browse files
Improve SimplifyLocals compile-time performance
1 parent 2fa35d6 commit d673f1b

File tree

2 files changed

+193
-36
lines changed

2 files changed

+193
-36
lines changed

src/ir/effects.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,20 @@ class EffectAnalyzer {
296296
return hasSideEffects() || accessesLocal() || readsMutableGlobalState();
297297
}
298298

299+
// Check if this has any ordering-relevant effects beyond local variable
300+
// access. This is used by SimplifyLocals' reverse-index optimization to
301+
// classify sinkables: those with only local effects can be looked up via
302+
// the local reverse index, while those with non-local effects need broader
303+
// conflict checks.
304+
//
305+
// This is derived from the same helpers used by orderedBefore(), so it
306+
// automatically stays in sync when new effect types are added.
307+
bool hasNonLocalOrderingEffects() const {
308+
return transfersControlFlow() || writesGlobalState() ||
309+
readsMutableGlobalState() || danglingPop || trap ||
310+
hasSynchronization() || mayNotReturn;
311+
}
312+
299313
// check if we break to anything external from ourselves
300314
bool hasExternalBreakTargets() const { return !breakTargets.empty(); }
301315

0 commit comments

Comments
 (0)