1; RUN: opt < %s -globalopt -S | FileCheck %s 2; rdar://12580965. 3; ObjC++ test case. 4 5%struct.ButtonInitData = type { i8* } 6 7@_ZL14buttonInitData = internal global [1 x %struct.ButtonInitData] zeroinitializer, align 4 8 9@"\01L_OBJC_METH_VAR_NAME_40" = internal global [7 x i8] c"print:\00", section "__TEXT,__objc_methname,cstring_literals", align 1 10@"\01L_OBJC_SELECTOR_REFERENCES_41" = internal externally_initialized global i8* getelementptr inbounds ([7 x i8], [7 x i8]* @"\01L_OBJC_METH_VAR_NAME_40", i32 0, i32 0), section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" 11 12@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @_GLOBAL__I_a }] 13@llvm.used = appending global [2 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @"\01L_OBJC_METH_VAR_NAME_40", i32 0, i32 0), i8* bitcast (i8** @"\01L_OBJC_SELECTOR_REFERENCES_41" to i8*)] 14 15define internal void @__cxx_global_var_init() section "__TEXT,__StaticInit,regular,pure_instructions" { 16 %1 = load i8*, i8** @"\01L_OBJC_SELECTOR_REFERENCES_41", !invariant.load !2009 17 store i8* %1, i8** getelementptr inbounds ([1 x %struct.ButtonInitData], [1 x %struct.ButtonInitData]* @_ZL14buttonInitData, i32 0, i32 0, i32 0), align 4 18 ret void 19} 20 21define internal void @_GLOBAL__I_a() section "__TEXT,__StaticInit,regular,pure_instructions" { 22 call void @__cxx_global_var_init() 23 ret void 24} 25 26declare void @test(i8*) 27 28define void @print() { 29; CHECK: %1 = load i8*, i8** @_ZL14buttonInitData.0.0, align 4 30 %1 = load i8*, i8** getelementptr inbounds ([1 x %struct.ButtonInitData], [1 x %struct.ButtonInitData]* @_ZL14buttonInitData, i32 0, i32 0, i32 0), align 4 31 call void @test(i8* %1) 32 ret void 33} 34 35!2009 = !{} 36