Open HerrCai0907 opened 1 month ago
See a related previous discussion here:
https://github.com/WebAssembly/binaryen/issues/5088#issuecomment-1262560728
Over there, we did not get a clear answer from VM people that one or the other order was better, so we did not change anything. But it may be worth revisiting this. If we have benchmarks that show another order is better, we can flip it.
See also https://github.com/llvm/llvm-project/issues/98631 and https://github.com/llvm/llvm-project/pull/97283 for discussions of a case where preferring a shallower stack has significant performance benefits.
These assemblyscript code
will be optimized to
Is there any benefit to exchange the operand of
i32.add
. the optimized version looks like cause higher register pressure for JIT / AOT wasm runtime.