Max Graey

Results 346 comments of Max Graey

@kripken Hi, is there any chance of merge with main branch? Or is something blocking this PR?

Thanks! Yes, I did not expect serious performance improvements because Wasm engines (except interpreted ones) have similar optimization pass, but this pass in theory could improve module size, at least...

But `optimizeTernary` only applies for `select` which can't be produced by `selectify` due to side effect (division). That's why I think it should be done by `CodeFolding` pass which operate...

> That would increase code size, though. Yes, that's may increase size for general case. But for load / store it actually may decrease size. For example: ```rust i32.load(p +...

Yeah, it seems it doesn't handle properly. Here example: ```wat (module (memory $0 0) (export "test" (func $test)) (export "memory" (memory $0)) (func $test (param $0 i32) (param $1 i32)...

And I don't think `optimizeAddedConstants` handle our case. It seems it handle cases like that only: ```rust ((x + 1) * 3) * 2 -> (x + 1) * 6...

Sure. But what about distribution optimization rules: ```rust (x + C1) (x

> Why is this always better in a load/store? I should clarify. It always better for `load/store` when `C1 * C2

I checked on SpiderMonkey: ```wat (module (memory $0 1) (export "opt" (func $opt)) (export "naive" (func $naive)) (func $opt (param $ptr i32) (param $idx i32) (result i32) (i32.load offset=16 (i32.add...