diff options
author | Alon Zakai <alonzakai@gmail.com> | 2018-04-30 11:19:52 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-30 11:19:52 -0700 |
commit | b38d9bc6c0d382aedd4c769093139a49ee69afdc (patch) | |
tree | 453229bc9c207054a0d47ca99649067c9d7d221b /src | |
parent | 032ddd6a88bf608953c76422c317eb5aa875985e (diff) | |
download | binaryen-b38d9bc6c0d382aedd4c769093139a49ee69afdc.tar.gz binaryen-b38d9bc6c0d382aedd4c769093139a49ee69afdc.tar.bz2 binaryen-b38d9bc6c0d382aedd4c769093139a49ee69afdc.zip |
flatten improvement (#1522)
Diffstat (limited to 'src')
-rw-r--r-- | src/passes/Flatten.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/passes/Flatten.cpp b/src/passes/Flatten.cpp index b3266e89b..f4b468098 100644 --- a/src/passes/Flatten.cpp +++ b/src/passes/Flatten.cpp @@ -257,14 +257,8 @@ struct Flatten : public WalkerPass<ExpressionStackWalker<Flatten, UnifiedExpress curr = getCurrent(); // we may have replaced it // we have changed children ReFinalizeNode().visit(curr); - // handle side effects and control flow, things we need to be - // in the prelude. note that we must handle anything here, not just - // side effects, as a sibling after us may have side effect for us, - // and thus we need to move in anticipation of that (e.g., we are - // a get, and a later sibling is a tee - if just the tee moves, - // that is bade) TODO optimize - if (isControlFlowStructure(curr) || EffectAnalyzer(getPassOptions(), curr).hasAnything()) { - // we need to move the side effects to the prelude + // move everything to the prelude, if we need to: anything but constants + if (!curr->is<Const>()) { if (curr->type == unreachable) { ourPreludes.push_back(curr); replaceCurrent(builder.makeUnreachable()); |