1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
;; RUN: env BINARYEN_PRINT_FULL=1 wasm-opt %s --merge-blocks -S -o - | filecheck %s
;; The optimization below will replace the local.set with the block it contains
;; (i.e. it reorders them). While doing so we should keep the debug info of the
;; local.set.
(module
;; CHECK: (func $test
;; CHECK-NEXT: (local $temp i32)
;; CHECK-NEXT: ;;@ src.cpp:200:2
;; CHECK-NEXT: (block (; none ;)
;; CHECK-NEXT: ;;@ src.cpp:200:2
;; CHECK-NEXT: (call $test) (; none ;)
;; CHECK-NEXT: ;;@ src.cpp:200:2
;; CHECK-NEXT: (local.set $temp (; local type: i32 ;)
;; CHECK-NEXT: ;;@ src.cpp:200:2
;; CHECK-NEXT: (i32.const 1) (; i32 ;)
;; CHECK-NEXT: ) (; none ;)
;; CHECK-NEXT: ) ;; end block (; none ;)
;; CHECK-NEXT: )
(func $test
(local $temp i32)
;; Everything here should stay with 200 as their debug info, while we
;; optimize (we can remove the inner block, move the call up to before
;; the local.set, and merge the outer blocks).
;;@ src.cpp:200:2
(block
(local.set $temp
(block (result i32)
(call $test)
(i32.const 1)
)
)
)
)
;; CHECK: (func $test-no-trample
;; CHECK-NEXT: (local $temp i32)
;; CHECK-NEXT: ;;@ src.cpp:300:3
;; CHECK-NEXT: (block (; none ;)
;; CHECK-NEXT: ;;@ src.cpp:400:4
;; CHECK-NEXT: (call $test) (; none ;)
;; CHECK-NEXT: ;;@ src.cpp:200:2
;; CHECK-NEXT: (local.set $temp (; local type: i32 ;)
;; CHECK-NEXT: ;;@ src.cpp:500:5
;; CHECK-NEXT: (i32.const 1) (; i32 ;)
;; CHECK-NEXT: ) (; none ;)
;; CHECK-NEXT: ) ;; end block (; none ;)
;; CHECK-NEXT: )
(func $test-no-trample
(local $temp i32)
;; As above, but now the inner block has debug info (300), which should not
;; be trampled as it is moved outside.
;;@ src.cpp:200:2
(local.set $temp
;;@ src.cpp:300:3
(block (result i32)
;;@ src.cpp:400:4
(call $test)
;;@ src.cpp:500:5
(i32.const 1)
)
)
)
)
|