-
Notifications
You must be signed in to change notification settings - Fork 745
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Wasm GC] ReFinalize when needed in SimplifyGlobals (#5682)
- Loading branch information
Showing
2 changed files
with
56 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. | ||
;; NOTE: This test was ported using port_passes_tests_to_lit.py and could be cleaned up. | ||
|
||
;; RUN: foreach %s %t wasm-opt --simplify-globals -all -S -o - | filecheck %s | ||
|
||
(module | ||
;; CHECK: (type $A (func)) | ||
(type $A (func)) | ||
|
||
;; CHECK: (global $global$0 funcref (ref.func $func)) | ||
(global $global$0 (mut funcref) (ref.func $func)) | ||
|
||
;; CHECK: (elem declare func $func) | ||
|
||
;; CHECK: (func $func (type $A) | ||
;; CHECK-NEXT: (drop | ||
;; CHECK-NEXT: (ref.cast $A | ||
;; CHECK-NEXT: (ref.func $func) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) | ||
;; CHECK-NEXT: ) | ||
(func $func | ||
(drop | ||
(ref.cast null $A | ||
;; This global can be replaced with a ref.func of $func. That has a more | ||
;; refined type, so we should refinalize (if we do not, then the ref.cast | ||
;; will fail to validate as it must become a non-nullable cast). | ||
(global.get $global$0) | ||
) | ||
) | ||
) | ||
) | ||
|