diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/lit/passes/inlining-eh.wast | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/test/lit/passes/inlining-eh.wast b/test/lit/passes/inlining-eh.wast index ea49c9550..7d804805e 100644 --- a/test/lit/passes/inlining-eh.wast +++ b/test/lit/passes/inlining-eh.wast @@ -76,7 +76,7 @@ ) ;; --------------------------------------------------------------------------- - (func $callee (result i32) + (func $callee-a (result i32) (i32.const 42) ) @@ -90,7 +90,7 @@ ;; CHECK-NEXT: (delegate 0) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (block (result i32) - ;; CHECK-NEXT: (block $__inlined_func$callee (result i32) + ;; CHECK-NEXT: (block $__inlined_func$callee-a (result i32) ;; CHECK-NEXT: (i32.const 42) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -100,6 +100,47 @@ (do) (delegate 0) ) - (call $callee) + (call $callee-a) + ) + + + ;; --------------------------------------------------------------------------- + (func $callee-b (param i32)) + + ;; CHECK: (func $caller-with-pop + ;; CHECK-NEXT: (local $0 i32) + ;; CHECK-NEXT: (local $1 i32) + ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (do + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (catch $tag$0 + ;; CHECK-NEXT: (local.set $1 + ;; CHECK-NEXT: (pop i32) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: (block $__inlined_func$callee-b + ;; CHECK-NEXT: (local.set $0 + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $caller-with-pop + (try + (do) + (catch $tag$0 + ;; After this $callee-b is inlined, there will be additional 'block's + ;; surrouding this 'pop', which makes its location invalid. We fix it by + ;; creating a new local to set the result of 'pop' and later use + ;; local.get to get the value within the inlined function body. + (call $callee-b + (pop i32) + ) + ) + ) ) ) |