summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAshley Nelson <nashley@google.com>2023-12-07 02:15:40 -0800
committerGitHub <noreply@github.com>2023-12-07 02:15:40 -0800
commit2049ee82d56f8cb1bb0107c9e260663e97bc4c17 (patch)
tree4069c52ae93affaba34ba9a49ef1d8bc74a18dc6 /test
parente28efb09c2b90b163cc2d251d0cd503b6f424af2 (diff)
downloadbinaryen-2049ee82d56f8cb1bb0107c9e260663e97bc4c17.tar.gz
binaryen-2049ee82d56f8cb1bb0107c9e260663e97bc4c17.tar.bz2
binaryen-2049ee82d56f8cb1bb0107c9e260663e97bc4c17.zip
[Outlining] Add loop instruction support
Adds support for the loop instruction to be outlined and a test showing a repeat loop being outlined. Reviewers: tlively Reviewed By: tlively Pull Request: https://github.com/WebAssembly/binaryen/pull/6141
Diffstat (limited to 'test')
-rw-r--r--test/lit/passes/outlining.wast37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/lit/passes/outlining.wast b/test/lit/passes/outlining.wast
index 98cb5a316..1c5ec06bd 100644
--- a/test/lit/passes/outlining.wast
+++ b/test/lit/passes/outlining.wast
@@ -726,3 +726,40 @@
;; CHECK-NEXT: (call $outline$)
;; CHECK-NEXT: (call $outline$)
;; CHECK-NEXT: )
+
+;; Outline a loop
+;; TODO: Ideally, a loop (like any control flow) repeated within a program can
+;; be outlined by itself. Right now this is not possible since a control flow
+;; is represented by a single symbol and only sequences of symbols >= 2 are
+;; candidates for outlining.
+(module
+ ;; CHECK: (type $0 (func))
+
+ ;; CHECK: (func $outline$ (type $0)
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.const 0)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (loop $loop-in
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+
+ ;; CHECK: (func $a (type $0)
+ ;; CHECK-NEXT: (call $outline$)
+ ;; CHECK-NEXT: )
+ (func $a
+ (drop
+ (i32.const 0)
+ )
+ (loop (nop))
+ )
+ ;; CHECK: (func $b (type $0)
+ ;; CHECK-NEXT: (call $outline$)
+ ;; CHECK-NEXT: )
+ (func $b
+ (drop
+ (i32.const 0)
+ )
+ (loop (nop))
+ )
+)