1 ; RUN: opt -passes=globalopt -S < %s | FileCheck %s
3 $comdat_global = comdat any
5 @comdat_global = weak_odr global i8 0, comdat($comdat_global)
6 @simple_global = internal global i8 0
7 ; CHECK: @comdat_global = weak_odr global i8 0, comdat{{$}}
8 ; CHECK: @simple_global = internal global i8 42
10 @llvm.global_ctors = appending global [2 x { i32, ptr, ptr }] [
11 { i32, ptr, ptr } { i32 65535, ptr @init_comdat_global, ptr @comdat_global },
12 { i32, ptr, ptr } { i32 65535, ptr @init_simple_global, ptr null }
14 ; CHECK: @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }]
15 ; CHECK: [{ i32, ptr, ptr } { i32 65535, ptr @init_comdat_global, ptr @comdat_global }]
17 define void @init_comdat_global() {
18 store i8 42, ptr @comdat_global
21 ; CHECK: define void @init_comdat_global()
23 define internal void @init_simple_global() comdat($comdat_global) {
24 store i8 42, ptr @simple_global
27 ; CHECK-NOT: @init_simple_global()
29 define ptr @use_simple() {
30 ret ptr @simple_global
32 ; CHECK: define ptr @use_simple()
34 define ptr @use_comdat() {
35 ret ptr @comdat_global
37 ; CHECK: define ptr @use_comdat()