File tree Expand file tree Collapse file tree 2 files changed +195
-38
lines changed
Expand file tree Collapse file tree 2 files changed +195
-38
lines changed Original file line number Diff line number Diff line change @@ -140,8 +140,8 @@ class EffectAnalyzer {
140140 const Module& module ;
141141 FeatureSet features;
142142
143- std::set <Index> localsRead;
144- std::set <Index> localsWritten;
143+ std::unordered_set <Index> localsRead;
144+ std::unordered_set <Index> localsWritten;
145145 std::unordered_set<Name> mutableGlobalsRead;
146146 std::unordered_set<Name> globalsWritten;
147147
@@ -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
You can’t perform that action at this time.
0 commit comments