summaryrefslogtreecommitdiff
path: root/test/lit/passes/gto-removals.wast
diff options
context:
space:
mode:
Diffstat (limited to 'test/lit/passes/gto-removals.wast')
-rw-r--r--test/lit/passes/gto-removals.wast63
1 files changed, 63 insertions, 0 deletions
diff --git a/test/lit/passes/gto-removals.wast b/test/lit/passes/gto-removals.wast
index a6fd9c228..6ab126611 100644
--- a/test/lit/passes/gto-removals.wast
+++ b/test/lit/passes/gto-removals.wast
@@ -1564,3 +1564,66 @@
(export "globalB" (global $globalB))
)
+;; Removed atomic sets needs special handling.
+(module
+ ;; CHECK: (rec
+ ;; CHECK-NEXT: (type $A (shared (struct)))
+ (type $A (shared (struct (mut i32))))
+
+ ;; CHECK: (type $1 (func (param (ref $A))))
+
+ ;; CHECK: (func $sets (type $1) (param $0 (ref $A))
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (ref.as_non_null
+ ;; CHECK-NEXT: (block (result (ref $A))
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.const 1)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.get $0)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (ref.as_non_null
+ ;; CHECK-NEXT: (block (result (ref $A))
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.const 1)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.get $0)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (block
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (ref.as_non_null
+ ;; CHECK-NEXT: (block (result (ref $A))
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.const 1)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.get $0)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (atomic.fence)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $sets (param (ref $A))
+ ;; Normal set is optimizable.
+ (struct.set $A 0
+ (local.get 0)
+ (i32.const 1)
+ )
+ ;; Release set is optimizable without a fence because there is no get to
+ ;; synchronize with.
+ (struct.atomic.set acqrel $A 0
+ (local.get 0)
+ (i32.const 1)
+ )
+ ;; This requires a fence to keep the effect on the global order of seqcst
+ ;; operations.
+ (struct.atomic.set $A 0
+ (local.get 0)
+ (i32.const 1)
+ )
+ )
+)