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, void ()*, i8* }] [
11 { i32, void ()*, i8* } { i32 65535, void ()* @init_comdat_global, i8* @comdat_global },
12 { i32, void ()*, i8* } { i32 65535, void ()* @init_simple_global, i8* null }
14 ; CHECK: @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }]
15 ; CHECK: [{ i32, void ()*, i8* } { i32 65535, void ()* @init_comdat_global, i8* @comdat_global }]
17 define void @init_comdat_global() {
18 store i8 42, i8* @comdat_global
21 ; CHECK: define void @init_comdat_global()
23 define internal void @init_simple_global() comdat($comdat_global) {
24 store i8 42, i8* @simple_global
27 ; CHECK-NOT: @init_simple_global()
29 define i8* @use_simple() {
30 ret i8* @simple_global
32 ; CHECK: define i8* @use_simple()
34 define i8* @use_comdat() {
35 ret i8* @comdat_global
37 ; CHECK: define i8* @use_comdat()