File tree Expand file tree Collapse file tree 7 files changed +289
-217
lines changed Expand file tree Collapse file tree 7 files changed +289
-217
lines changed Original file line number Diff line number Diff line change @@ -1514,6 +1514,7 @@ export class Module {
1514
1514
passes . push ( "remove-unused-brs" ) ;
1515
1515
passes . push ( "remove-unused-names" ) ;
1516
1516
passes . push ( "merge-blocks" ) ;
1517
+ passes . push ( "precompute" ) ;
1517
1518
}
1518
1519
if ( optimizeLevel >= 3 ) {
1519
1520
passes . push ( "flatten" ) ;
@@ -1545,7 +1546,6 @@ export class Module {
1545
1546
} else {
1546
1547
passes . push ( "precompute" ) ;
1547
1548
}
1548
- passes . push ( "vacuum" ) ;
1549
1549
if ( optimizeLevel >= 2 || shrinkLevel >= 1 ) {
1550
1550
passes . push ( "pick-load-signs" ) ;
1551
1551
passes . push ( "simplify-globals-optimizing" ) ;
@@ -1633,7 +1633,6 @@ export class Module {
1633
1633
passes . push ( "vacuum" ) ;
1634
1634
1635
1635
passes . push ( "precompute-propagate" ) ;
1636
- passes . push ( "vacuum" ) ;
1637
1636
1638
1637
// replace indirect with direct calls again and inline
1639
1638
passes . push ( "inlining-optimizing" ) ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "asc_flags" : [
3
+ " --runtime none"
4
+ ]
5
+ }
Original file line number Diff line number Diff line change
1
+ (module
2
+ (type $i64_=>_i64 (func (param i64 ) (result i64 )))
3
+ (memory $0 0 )
4
+ (export " memory" (memory $0 ))
5
+ (export " test" (func $const-folding/test ))
6
+ (func $const-folding/test (param $0 i64 ) (result i64 )
7
+ local.get $0
8
+ i64.const 1
9
+ i64.shl
10
+ local.get $0
11
+ i64.const 63
12
+ i64.shr_u
13
+ i64.add
14
+ )
15
+ )
Original file line number Diff line number Diff line change
1
+ export function test ( value : u64 ) : u64 {
2
+ var mod1 : u64 = - 1 ;
3
+ var mod2 : u64 = - 1 ;
4
+
5
+ var rlo = value << 1 ;
6
+ var rhi = rlo & ~ mod2 ;
7
+
8
+ rhi |= rhi << 1 ;
9
+ rhi |= ( value >> 63 ) & mod1 ;
10
+ return rlo + rhi ;
11
+ }
Original file line number Diff line number Diff line change
1
+ (module
2
+ (type $i64_=>_i64 (func (param i64 ) (result i64 )))
3
+ (memory $0 0 )
4
+ (table $0 1 funcref )
5
+ (export " memory" (memory $0 ))
6
+ (export " test" (func $const-folding/test ))
7
+ (func $const-folding/test (param $0 i64 ) (result i64 )
8
+ (local $1 i64 )
9
+ (local $2 i64 )
10
+ (local $3 i64 )
11
+ (local $4 i64 )
12
+ i64.const -1
13
+ local.set $1
14
+ i64.const -1
15
+ local.set $2
16
+ local.get $0
17
+ i64.const 1
18
+ i64.shl
19
+ local.set $3
20
+ local.get $3
21
+ local.get $2
22
+ i64.const -1
23
+ i64.xor
24
+ i64.and
25
+ local.set $4
26
+ local.get $4
27
+ local.get $4
28
+ i64.const 1
29
+ i64.shl
30
+ i64.or
31
+ local.set $4
32
+ local.get $4
33
+ local.get $0
34
+ i64.const 63
35
+ i64.shr_u
36
+ local.get $1
37
+ i64.and
38
+ i64.or
39
+ local.set $4
40
+ local.get $3
41
+ local.get $4
42
+ i64.add
43
+ )
44
+ )
You can’t perform that action at this time.
0 commit comments