summaryrefslogtreecommitdiff
path: root/test/lit/binary/name-overlap.test
blob: 7f5318737838ac7a4ff8b1e1b3e09fa1475b69bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
;; RUN: wasm-opt %s.wasm -S -o - | filecheck %s

;; Test that we emit deduplicated names even in the corner case that one item
;; is in the names section and the other is not, and the latter's temp name
;; coincides with the name the name section gives for the first. Specifically,
;; the input wasm looks like this:
;;
;;  (module
;;   (global $global$1 i32 (i32.const 1)) ;; In names section.
;;   (global $........ i32 (i32.const 0)) ;; *Not* in names section.
;;  )
;;
;; We give them temp names $global$0, $global$1 to begin with, then apply the
;; names section which turns the first's name into $global$1 - identical to the
;; second. We must then deduplicate the second name to avoid a collision. (Note
;; that we leave the name from the names section as it is, and only adjust the
;; temp name.)

;; CHECK:       (global $global$1 i32 (i32.const 1))
;; CHECK-NEXT:  (global $global$1.1 i32 (i32.const 0))