khagankhan opened issue #11722:
Hello. I am doing some fun project myself and I would like to know whether you are interested in missed otimizations in cranelift. For example:
Not optimized to a constant matching execution (-1). Dumping CLIF from /tmp/.tmp1PhnFo/wasm[0]--function[0]--main.clif: =================== CLIF BEGIN =================== ;; Intermediate Representation of function <wasm[0]::function[0]::main>: function u0:0(i64 vmctx, i64) -> i32 tail { gv0 = vmctx gv1 = load.i64 notrap aligned readonly gv0+8 gv2 = load.i64 notrap aligned gv1+16 stack_limit = gv2 block0(v0: i64, v1: i64): @002e jump block1 block1: @0022 v3 = iconst.i32 -355 @0025 v4 = iconst.i32 20 @0027 v5 = rotl v3, v4 ; v3 = -355, v4 = 20 @0028 v6 = iconst.i32 -9828254 @002d v7 = bor v5, v6 ; v6 = -9828254 @002e return v7 } ==================== CLIF END ==================== khan22@node0:~/wasmoi/code_generator$ cat p.wat (module (func $main (export "main") (result i32) (i32.or (i32.rotl (i32.const -355) (i32.const 20)) (i32.const -9828254))))
cfallin commented on issue #11722:
It appears we don't have a mid-end rule for constant-propagating rotates (e.g.
rotl) in our constant-propagation rules; PRs welcome if you want to try your hand at these!
khagankhan commented on issue #11722:
That would be fun! I am building an automated tool to find missed opts. So I think I can find them and also make a PR each time :)
Last updated: Dec 06 2025 at 06:05 UTC