blob: c4962af20fcad9c0dc4a95218f9aab03f74254f2 [file] [edit]
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
;; Check that "trivial calls" are always inlined, even when optimizing for
;; size.
;;
;; A trivial call is a function that calls another, using its locals in
;; the order, without skipping any locals.
;;
;; These functions can always be inlined because they can't cause binary size
;; increase at the call sites.
;; RUN: foreach %s %t wasm-opt -all --inlining --shrink-level=0 -S -o - | filecheck %s
;; RUN: foreach %s %t wasm-opt -all --inlining --shrink-level=1 -S -o - | filecheck %s
;; RUN: foreach %s %t wasm-opt -all --inlining --shrink-level=2 -S -o - | filecheck %s
;; RUN: foreach %s %t wasm-opt -all --inlining --shrink-level=3 -S -o - | filecheck %s
(module
;; CHECK: (type $0 (func (param i32 i32 i32 i32 i32 i32)))
(type $0 (func (param i32 i32 i32 i32 i32 i32)))
;; CHECK: (type $1 (func))
(type $1 (func))
;; CHECK: (import "env" "foo" (func $imported-foo (type $0) (param i32 i32 i32 i32 i32 i32)))
(import "env" "foo" (func $imported-foo (type $0) (param i32 i32 i32 i32 i32 i32)))
(func $call-foo (type $0) (param $p1 i32) (param $p2 i32) (param $p3 i32) (param $p4 i32) (param $p5 i32) (param $p6 i32)
(call $imported-foo
(local.get $p1)
(local.get $p2)
(local.get $p3)
(local.get $p4)
(local.get $p5)
(local.get $p6)
)
)
;; CHECK: (func $main (type $1)
;; CHECK-NEXT: (local $0 i32)
;; CHECK-NEXT: (local $1 i32)
;; CHECK-NEXT: (local $2 i32)
;; CHECK-NEXT: (local $3 i32)
;; CHECK-NEXT: (local $4 i32)
;; CHECK-NEXT: (local $5 i32)
;; CHECK-NEXT: (local $6 i32)
;; CHECK-NEXT: (local $7 i32)
;; CHECK-NEXT: (local $8 i32)
;; CHECK-NEXT: (local $9 i32)
;; CHECK-NEXT: (local $10 i32)
;; CHECK-NEXT: (local $11 i32)
;; CHECK-NEXT: (local $12 i32)
;; CHECK-NEXT: (local $13 i32)
;; CHECK-NEXT: (local $14 i32)
;; CHECK-NEXT: (local $15 i32)
;; CHECK-NEXT: (local $16 i32)
;; CHECK-NEXT: (local $17 i32)
;; CHECK-NEXT: (block $__inlined_func$call-foo
;; CHECK-NEXT: (local.set $0
;; CHECK-NEXT: (i32.const 1)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $1
;; CHECK-NEXT: (i32.const 2)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $2
;; CHECK-NEXT: (i32.const 3)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $3
;; CHECK-NEXT: (i32.const 4)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $4
;; CHECK-NEXT: (i32.const 5)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $5
;; CHECK-NEXT: (i32.const 6)
;; CHECK-NEXT: )
;; CHECK-NEXT: (call $imported-foo
;; CHECK-NEXT: (local.get $0)
;; CHECK-NEXT: (local.get $1)
;; CHECK-NEXT: (local.get $2)
;; CHECK-NEXT: (local.get $3)
;; CHECK-NEXT: (local.get $4)
;; CHECK-NEXT: (local.get $5)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (block $__inlined_func$call-foo$1
;; CHECK-NEXT: (local.set $6
;; CHECK-NEXT: (i32.const 7)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $7
;; CHECK-NEXT: (i32.const 8)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $8
;; CHECK-NEXT: (i32.const 9)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $9
;; CHECK-NEXT: (i32.const 10)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $10
;; CHECK-NEXT: (i32.const 11)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $11
;; CHECK-NEXT: (i32.const 12)
;; CHECK-NEXT: )
;; CHECK-NEXT: (call $imported-foo
;; CHECK-NEXT: (local.get $6)
;; CHECK-NEXT: (local.get $7)
;; CHECK-NEXT: (local.get $8)
;; CHECK-NEXT: (local.get $9)
;; CHECK-NEXT: (local.get $10)
;; CHECK-NEXT: (local.get $11)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (block $__inlined_func$call-foo$2
;; CHECK-NEXT: (local.set $12
;; CHECK-NEXT: (i32.const 13)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $13
;; CHECK-NEXT: (i32.const 14)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $14
;; CHECK-NEXT: (i32.const 15)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $15
;; CHECK-NEXT: (i32.const 16)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $16
;; CHECK-NEXT: (i32.const 17)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $17
;; CHECK-NEXT: (i32.const 18)
;; CHECK-NEXT: )
;; CHECK-NEXT: (call $imported-foo
;; CHECK-NEXT: (local.get $12)
;; CHECK-NEXT: (local.get $13)
;; CHECK-NEXT: (local.get $14)
;; CHECK-NEXT: (local.get $15)
;; CHECK-NEXT: (local.get $16)
;; CHECK-NEXT: (local.get $17)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $main (type $1)
(call $call-foo
(i32.const 1)
(i32.const 2)
(i32.const 3)
(i32.const 4)
(i32.const 5)
(i32.const 6)
)
(call $call-foo
(i32.const 7)
(i32.const 8)
(i32.const 9)
(i32.const 10)
(i32.const 11)
(i32.const 12)
)
(call $call-foo
(i32.const 13)
(i32.const 14)
(i32.const 15)
(i32.const 16)
(i32.const 17)
(i32.const 18)
)
)
)