1; RUN: opt -globalopt -S < %s | FileCheck %s 2 3$comdat_global = comdat any 4 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 9 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 } 13] 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 }] 16 17define void @init_comdat_global() { 18 store i8 42, i8* @comdat_global 19 ret void 20} 21; CHECK: define void @init_comdat_global() 22 23define internal void @init_simple_global() comdat($comdat_global) { 24 store i8 42, i8* @simple_global 25 ret void 26} 27; CHECK-NOT: @init_simple_global() 28 29define i8* @use_simple() { 30 ret i8* @simple_global 31} 32; CHECK: define i8* @use_simple() 33 34define i8* @use_comdat() { 35 ret i8* @comdat_global 36} 37; CHECK: define i8* @use_comdat() 38