Skip to content

Missed optimizations #11722

@khagankhan

Description

@khagankhan

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))))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions