diff options
author | Alon Zakai <azakai@google.com> | 2024-10-08 11:41:24 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-08 11:41:24 -0700 |
commit | 930034ff1637f611a05582ac28fb734d6503b12e (patch) | |
tree | 6c09f7f37cd2be3105e10e9a6359fc41f6fa7e1b /src | |
parent | 1eb01260efdcb65828c81cf5f72fb358b03d2328 (diff) | |
download | binaryen-930034ff1637f611a05582ac28fb734d6503b12e.tar.gz binaryen-930034ff1637f611a05582ac28fb734d6503b12e.tar.bz2 binaryen-930034ff1637f611a05582ac28fb734d6503b12e.zip |
Fix flow reset during throw => break opts in RemoveUnusedBrs (#6993)
#6980 was missing the logic to reset flows after replacing a throw. The process
of replacing the throw introduces new code and in particular a drop, which
blocks branches from flowing to their targets.
In the testcase here, the br was turned into nop before this fix.
Diffstat (limited to 'src')
-rw-r--r-- | src/passes/RemoveUnusedBrs.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/passes/RemoveUnusedBrs.cpp b/src/passes/RemoveUnusedBrs.cpp index c2370aca6..c2f470d80 100644 --- a/src/passes/RemoveUnusedBrs.cpp +++ b/src/passes/RemoveUnusedBrs.cpp @@ -518,6 +518,10 @@ struct RemoveUnusedBrs : public WalkerPass<PostWalker<RemoveUnusedBrs>> { auto* rep = getDroppedChildrenAndAppend( curr, wasm, getPassOptions(), br, DropMode::IgnoreParentEffects); replaceCurrent(rep); + // We modified the code here and may have added a drop, etc., so + // stop the flow (rather than re-scan it somehow). We leave + // optimizing anything that flows out for later iterations. + stopFlow(); } // Return even if we did not optimize: we found our tag was caught. |