Skip to content

Commit 4fdef72

Browse files
committed
better
1 parent 2666c47 commit 4fdef72

File tree

2 files changed

+16
-24
lines changed

2 files changed

+16
-24
lines changed

src/module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,12 +1546,12 @@ export class Module {
15461546
// passes.push("post-assemblyscript");
15471547
// }
15481548
passes.push("optimize-instructions");
1549-
passes.push("remove-unused-brs");
1550-
passes.push("remove-unused-names");
15511549
if (optimizeLevel >= 3 || shrinkLevel >= 1) {
15521550
passes.push("dce");
15531551
passes.push("inlining");
15541552
}
1553+
passes.push("remove-unused-brs");
1554+
passes.push("remove-unused-names");
15551555
if (optimizeLevel >= 3 || shrinkLevel >= 2) {
15561556
passes.push("precompute-propagate");
15571557
} else {

tests/compiler/loop-flow.optimized.wat

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,13 @@
3535
if
3636
local.get $0
3737
i32.const 2
38-
i32.eq
39-
if
40-
i32.const 1088
41-
i32.const 1040
42-
i32.const 24
43-
i32.const 22
44-
call $~lib/builtins/abort
45-
unreachable
46-
else
47-
br $while-continue|0
48-
end
38+
i32.ne
39+
br_if $while-continue|0
40+
i32.const 1088
41+
i32.const 1040
42+
i32.const 24
43+
i32.const 22
44+
call $~lib/builtins/abort
4945
unreachable
5046
end
5147
end
@@ -89,17 +85,13 @@
8985
if
9086
local.get $0
9187
i32.const 2
92-
i32.eq
93-
if
94-
i32.const 1088
95-
i32.const 1040
96-
i32.const 78
97-
i32.const 22
98-
call $~lib/builtins/abort
99-
unreachable
100-
else
101-
br $do-continue|0
102-
end
88+
i32.ne
89+
br_if $do-continue|0
90+
i32.const 1088
91+
i32.const 1040
92+
i32.const 78
93+
i32.const 22
94+
call $~lib/builtins/abort
10395
unreachable
10496
end
10597
end

0 commit comments

Comments
 (0)