1 ;; Check that runtime symbols get appropriate linkage. 2 3 ; RUN: opt < %s -mtriple=x86_64-apple-macosx10.10.0 -instrprof -S | FileCheck %s --check-prefix=OTHER --check-prefix=COMMON 4 ; RUN: opt < %s -mtriple=x86_64-unknown-linux -instrprof -S | FileCheck %s --check-prefix=LINUX --check-prefix=COMMON 5 6 @__profn_foo = hidden constant [3 x i8] c"foo" 7 @__profn_foo_weak = weak hidden constant [8 x i8] c"foo_weak" 8 @"__profn_linkage.ll:foo_internal" = internal constant [23 x i8] c"linkage.ll:foo_internal" 9 @__profn_foo_inline = linkonce_odr hidden constant [10 x i8] c"foo_inline" 10 11 ; COMMON: @__profc_foo = hidden global 12 ; COMMON: @__profd_foo = hidden global 13 define void @foo() { 14 call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 0, i32 1, i32 0) 15 ret void 16 } 17 18 ; COMMON: @__profc_foo_weak = weak hidden global 19 ; COMMON: @__profd_foo_weak = weak hidden global 20 define weak void @foo_weak() { 21 call void @llvm.instrprof.increment(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @__profn_foo_weak, i32 0, i32 0), i64 0, i32 1, i32 0) 22 ret void 23 } 24 25 ; COMMON: @"__profc_linkage.ll:foo_internal" = internal global 26 ; COMMON: @"__profd_linkage.ll:foo_internal" = internal global 27 define internal void @foo_internal() { 28 call void @llvm.instrprof.increment(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @"__profn_linkage.ll:foo_internal", i32 0, i32 0), i64 0, i32 1, i32 0) 29 ret void 30 } 31 32 ; COMMON: @__profc_foo_inline = linkonce_odr hidden global 33 ; COMMON: @__profd_foo_inline = linkonce_odr hidden global 34 define linkonce_odr void @foo_inline() { 35 call void @llvm.instrprof.increment(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @__profn_foo_inline, i32 0, i32 0), i64 0, i32 1, i32 0) 36 ret void 37 } 38 39 declare void @llvm.instrprof.increment(i8*, i64, i32, i32) 40 41 ; OTHER: @__llvm_profile_runtime = external global i32 42 ; LINUX-NOT: @__llvm_profile_runtime = external global i32 43 44 ; OTHER: define linkonce_odr hidden i32 @__llvm_profile_runtime_user() {{.*}} { 45 ; OTHER: %[[REG:.*]] = load i32, i32* @__llvm_profile_runtime 46 ; OTHER: ret i32 %[[REG]] 47 ; OTHER: } 48 ; LINUX-NOT: define linkonce_odr hidden i32 @__llvm_profile_runtime_user() {{.*}} { 49 ; LINUX-NOT: %[[REG:.*]] = load i32, i32* @__llvm_profile_runtime 50