| ;; 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 -all --simplify-globals -S -o - | filecheck %s |
| |
| ;; When a global is copied into another, prefer the earlier one in later gets. |
| ;; |
| ;; The global.gets in the definitions of $global2,3,4 should all point to |
| ;; $global1, as should the gets in the function below. |
| (module |
| ;; CHECK: (type $0 (func)) |
| |
| ;; CHECK: (import "a" "b" (global $global1 i32)) |
| (import "a" "b" (global $global1 i32)) |
| |
| ;; CHECK: (global $global2 i32 (global.get $global1)) |
| (global $global2 i32 (global.get $global1)) |
| |
| ;; CHECK: (global $global3 i32 (global.get $global1)) |
| (global $global3 i32 (global.get $global2)) |
| |
| ;; CHECK: (global $global4 i32 (global.get $global1)) |
| (global $global4 i32 (global.get $global3)) |
| |
| ;; CHECK: (func $simple (type $0) |
| ;; CHECK-NEXT: (drop |
| ;; CHECK-NEXT: (global.get $global1) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: (drop |
| ;; CHECK-NEXT: (global.get $global1) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: (drop |
| ;; CHECK-NEXT: (global.get $global1) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: (drop |
| ;; CHECK-NEXT: (global.get $global1) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: ) |
| (func $simple |
| (drop |
| (global.get $global1) |
| ) |
| (drop |
| (global.get $global2) |
| ) |
| (drop |
| (global.get $global3) |
| ) |
| (drop |
| (global.get $global4) |
| ) |
| ) |
| ) |