summaryrefslogtreecommitdiff
path: root/test/lit/debug
diff options
context:
space:
mode:
Diffstat (limited to 'test/lit/debug')
-rw-r--r--test/lit/debug/replace-keep.wat40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/lit/debug/replace-keep.wat b/test/lit/debug/replace-keep.wat
new file mode 100644
index 000000000..1418d13dd
--- /dev/null
+++ b/test/lit/debug/replace-keep.wat
@@ -0,0 +1,40 @@
+;; 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: [none] ;;@ src.cpp:200:2
+ ;; CHECK-NEXT: [none](block
+ ;; CHECK-NEXT: [none] ;;@ src.cpp:200:2
+ ;; CHECK-NEXT: (call $test)
+ ;; CHECK-NEXT: [none] ;;@ src.cpp:200:2
+ ;; CHECK-NEXT: (local.set $temp
+ ;; CHECK-NEXT: [i32] ;;@ src.cpp:200:2
+ ;; CHECK-NEXT: (i32.const 1)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: ) ;; end block
+ ;; 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)
+ )
+ )
+ )
+ )
+)