Max Graey
Max Graey
This part: ```wat (i32.xor (i32.shl (i32.const 1) (local.get $0) ) (i32.const -1) ) ``` after OptimizeInstruction pass should be simplified to: ```wat (i32.rotl (i32.const -2) (local.get $0) ) ``` But...
I figured out it's basically a usual issue for all mutable globals. Optimized such mutable globals quite useful due to may give further improvements like remove "mut" from global if...
Will be great also add this rules: ``` x ? x : y ==> x | y x ? y : x ==> x & y ``` x, y
LGTM from my side
@kripken could you merge this?
The point is that some passes may be needed for wasm-opt, which we also build in binaryen.js
I think precompute-propagate could be speedup also if interpreter will avoid exceptions: https://github.com/WebAssembly/binaryen/issues/2917#issuecomment-715985374 and uses monadic Expect / Result instead
Another variant is rewrite simple constant propagation algorithm to [Sparse Conditional Constant Propagation](https://karkare.github.io/cs738/lecturenotes/11CondConstPropHandout.pdf) (SCCP pass in LLVM) which should be mush faster
Could you try [small_set](https://github.com/WebAssembly/binaryen/blob/main/src/support/small_set.h) in `EffectsAnalyzer` instead of your custom `fake_set`?
Hmm. in this case I guess make sense use `small_set`s instead `std::set`s but init/alloc they lazily (by wrapping by `std::unique_ptr` for example) in `EffectsAnalyzer`