1 ; RUN: opt < %s -mtriple=x86_64 -passes=internalize -internalize-public-api-list main -internalize-public-api-list c1 -internalize-public-api-list c2 \
2 ; RUN: -internalize-public-api-list c3 -internalize-public-api-list c4 -S | FileCheck %s --check-prefixes=CHECK,NODUP
3 ; RUN: opt < %s -mtriple=x86_64-windows -passes=internalize -internalize-public-api-list main -internalize-public-api-list c1 -internalize-public-api-list c2 \
4 ; RUN: -internalize-public-api-list c3 -internalize-public-api-list c4 -S | FileCheck %s --check-prefixes=CHECK,NODUP
5 ; RUN: opt < %s -mtriple=wasm32 -passes=internalize -internalize-public-api-list main -internalize-public-api-list c1 -internalize-public-api-list c2 \
6 ; RUN: -internalize-public-api-list c3 -internalize-public-api-list c4 -S | FileCheck %s --check-prefixes=CHECK,WASM
14 ; CHECK: $c1 = comdat any
16 ;; wasm doesn't support nodeduplicate.
17 ; NODUP: $c2 = comdat nodeduplicate
18 ; WASM: $c2 = comdat any
20 ; CHECK: $c3 = comdat any
21 ; CHECK: $c4 = comdat any
23 ; CHECK: @c1_c = global i32 0, comdat($c1)
24 @c1_c = global i32 0, comdat($c1)
26 ;; $c2 has more than one member. Keep the comdat.
27 ; CHECK: @c2_b = internal global i32 0, comdat($c2)
28 @c2_b = global i32 0, comdat($c2)
30 ; CHECK: @c3 = global i32 0, comdat{{$}}
31 @c3 = global i32 0, comdat
33 ; CHECK: @c4_a = internal global i32 0, comdat($c4)
34 @c4_a = internal global i32 0, comdat($c4)
36 ; CHECK: @c1_d = alias i32, ptr @c1_c
37 @c1_d = alias i32, ptr @c1_c
39 ; CHECK: @c2_c = internal alias i32, ptr @c2_b
40 @c2_c = alias i32, ptr @c2_b
42 ; CHECK: @c4 = alias i32, ptr @c4_a
43 @c4 = alias i32, ptr @c4_a
45 ; CHECK: define void @c1() comdat {
46 define void @c1() comdat {
50 ; CHECK: define void @c1_a() comdat($c1) {
51 define void @c1_a() comdat($c1) {
55 ; CHECK: define internal void @c2() comdat {
56 define internal void @c2() comdat {
60 ; CHECK: define internal void @c2_a() comdat($c2) {
61 define void @c2_a() comdat($c2) {
65 ; CHECK: define void @c3_a() comdat($c3) {
66 define void @c3_a() comdat($c3) {
70 ;; There is only one member in the comdat. Delete the comdat as a size optimization.
71 ; CHECK: define internal void @c5() {
72 define void @c5() comdat($c5) {
76 ;; Add a non-comdat symbol to ensure the module ID is not empty so that we can
77 ;; create unique comdat names.