Skip to content

Extend getMaxbits to handle Block type #7590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jun 3, 2025
Prev Previous commit
Next Next commit
Add test
  • Loading branch information
xuruiyang2002 committed May 14, 2025
commit 95808a7d26f7d2d215834f485f01434c912b7c49
104 changes: 98 additions & 6 deletions test/lit/passes/optimize-instructions-mvp.wast
Original file line number Diff line number Diff line change
Expand Up @@ -8412,36 +8412,128 @@
(i32.const 0)
)
)
;; CHECK: (func $andZero (param $0 i32) (result i32)
;; CHECK: (func $andZero (param $0 i32) (param $1 i64) (result i32)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (i32.const 0)
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (i64.const 0)
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (block (result i32)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (local.tee $0
;; CHECK-NEXT: (i32.const 1)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (i32.const 0)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (block (result i64)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (local.tee $1
;; CHECK-NEXT: (i64.const 1)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (i64.const 0)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (block (result i32)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (call $andZero
;; CHECK-NEXT: (i32.const 1234)
;; CHECK-NEXT: (local.tee $0
;; CHECK-NEXT: (i32.const 1)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (block (result i32)
;; CHECK-NEXT: (local.set $0
;; CHECK-NEXT: (i32.const 1)
;; CHECK-NEXT: )
;; CHECK-NEXT: (i32.const 0)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (i32.const 0)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (block (result i64)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (local.tee $1
;; CHECK-NEXT: (i64.const 1)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (block (result i64)
;; CHECK-NEXT: (local.set $1
;; CHECK-NEXT: (i64.const 1)
;; CHECK-NEXT: )
;; CHECK-NEXT: (i64.const 0)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (i64.const 0)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
(func $andZero (param $0 i32) (result i32)
(func $andZero (param $0 i32) (param $1 i64) (result i32)
(drop
(i32.and
(local.get $0)
(i32.const 0)
)
)
(drop
(i64.and
(local.get $1)
(i64.const 0)
)
)
;; side effects, we must keep this, but
;; can drop it.
(drop
(i32.and
(call $andZero (i32.const 1234)) ;; side effects, we must keep this, but
;; can drop it.
(local.tee $0
(i32.const 1)
)
(i32.const 0)
)
)
(drop
(i64.and
(local.tee $1
(i64.const 1)
)
(i64.const 0)
)
)
(drop
(i32.and
(local.tee $0
(i32.const 1)
)
(block (result i32)
(local.set $0
(i32.const 1)
)
(i32.const 0)
)
)
)
(drop
(i64.and
(local.tee $1
(i64.const 1)
)
(block (result i64)
(local.set $1
(i64.const 1)
)
(i64.const 0)
)
)
)
(unreachable)
)
;; CHECK: (func $abstract-additions (param $x32 i32) (param $x64 i64) (param $y32 f32) (param $y64 f64)
Expand Down
Loading