summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-03-07 20:14:57 -0800
committerAlon Zakai <alonzakai@gmail.com>2016-03-07 20:14:57 -0800
commit8d71da97f2901971c136bf5902fe5e5f128b6aba (patch)
tree260504c0d413492274bc034d1e2fdf1f4594434d /src
parent284ae677cca8794a464f9bf702e3ec6aace6c65b (diff)
downloadbinaryen-8d71da97f2901971c136bf5902fe5e5f128b6aba.tar.gz
binaryen-8d71da97f2901971c136bf5902fe5e5f128b6aba.tar.bz2
binaryen-8d71da97f2901971c136bf5902fe5e5f128b6aba.zip
remove old and invalid optimization pass in asm2wasm
Diffstat (limited to 'src')
-rw-r--r--src/asm2wasm.h33
1 files changed, 0 insertions, 33 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h
index 355a521f1..aa59faa2d 100644
--- a/src/asm2wasm.h
+++ b/src/asm2wasm.h
@@ -1534,39 +1534,6 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) {
}
void Asm2WasmBuilder::optimize() {
- // Optimization passes. Note: no effort is made to free nodes that are no longer held on to.
-
- struct BlockBreakOptimizer : public WasmWalker<BlockBreakOptimizer> {
- void visitBlock(Block *curr) {
- // if the block ends in a break on this very block, then just put the value there
- Break *last = curr->list[curr->list.size()-1]->dyn_cast<Break>();
- if (last && last->value && last->name == curr->name) {
- curr->list[curr->list.size()-1] = last->value;
- }
- if (curr->list.size() > 1) return; // no hope to remove the block
- // just one element; maybe we can return just the element
- if (curr->name.isNull()) {
- replaceCurrent(curr->list[0]); // cannot break into it
- return;
- }
- // we might be broken to, but maybe there isn't a break (and we may have removed it, leading to this)
- // look for any breaks to this block
- BreakSeeker breakSeeker(curr->name);
- Expression *child = curr->list[0];
- breakSeeker.walk(child);
- if (breakSeeker.found == 0) {
- replaceCurrent(child); // no breaks to here, so eliminate the block
- }
- }
- };
-
- BlockBreakOptimizer blockBreakOptimizer;
- for (auto pair : wasm.functionsMap) {
- blockBreakOptimizer.startWalk(pair.second);
- }
-
- // Standard passes
-
PassRunner passRunner(&allocator);
passRunner.add("remove-unused-brs");
passRunner.add("remove-unused-names");