diff options
author | Heejin Ahn <aheejin@gmail.com> | 2020-06-02 00:01:58 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-02 00:01:58 -0700 |
commit | 1b8942ce72a25e1e3d63128660d76b5ecde8acfb (patch) | |
tree | 849b61c83958da0782417653949c6da51e0250b0 | |
parent | 65d495f50a8e804c2d38505201ef5afc448dab86 (diff) | |
download | binaryen-1b8942ce72a25e1e3d63128660d76b5ecde8acfb.tar.gz binaryen-1b8942ce72a25e1e3d63128660d76b5ecde8acfb.tar.bz2 binaryen-1b8942ce72a25e1e3d63128660d76b5ecde8acfb.zip |
Fix SideEffect::Branches to only represent branches (#2886)
After #2783 `SideEffects::Branches` includes possibly throwing
expressions, which can be calls (when EH is enabled). This changes
`SideEffects::Branches` back to only include branches, returns, and
infinite loops as it was before #2783.
-rw-r--r-- | src/ir/effects.h | 2 | ||||
-rw-r--r-- | test/binaryen.js/sideffects.js | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/ir/effects.h b/src/ir/effects.h index ff641e4d9..d2afc8133 100644 --- a/src/ir/effects.h +++ b/src/ir/effects.h @@ -504,7 +504,7 @@ struct EffectAnalyzer }; uint32_t getSideEffects() const { uint32_t effects = 0; - if (transfersControlFlow()) { + if (branchesOut || hasExternalBreakTargets()) { effects |= SideEffects::Branches; } if (calls) { diff --git a/test/binaryen.js/sideffects.js b/test/binaryen.js/sideffects.js index 7db9ab329..76bc1db68 100644 --- a/test/binaryen.js/sideffects.js +++ b/test/binaryen.js/sideffects.js @@ -95,11 +95,11 @@ assert( ); // If exception handling feature is enabled, calls can throw -var module_all_features = new binaryen.Module(); -module_all_features.setFeatures(binaryen.Features.All); +module.setFeatures(binaryen.Features.All); assert( binaryen.getSideEffects( - module.call("test", [], binaryen.i32) + module.call("test", [], binaryen.i32), + module.getFeatures() ) == binaryen.SideEffects.Calls | binaryen.SideEffects.Throws |