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; RUN: opt < %s -mtriple=x86_64-apple-macosx10.10.0 -passes=instrprof -S | FileCheck %s --check-prefix=OTHER --check-prefix=COMMON 6; RUN: opt < %s -mtriple=x86_64-unknown-linux -passes=instrprof -S | FileCheck %s --check-prefix=LINUX --check-prefix=COMMON 7; RUN: opt < %s -mtriple=x86_64-pc-win32-coff -instrprof -S | FileCheck %s --check-prefix=COFF 8; RUN: opt < %s -mtriple=x86_64-pc-win32-coff -passes=instrprof -S | FileCheck %s --check-prefix=COFF 9 10@__profn_foo = hidden constant [3 x i8] c"foo" 11@__profn_foo_weak = weak hidden constant [8 x i8] c"foo_weak" 12@"__profn_linkage.ll:foo_internal" = internal constant [23 x i8] c"linkage.ll:foo_internal" 13@__profn_foo_inline = linkonce_odr hidden constant [10 x i8] c"foo_inline" 14@__profn_foo_extern = linkonce_odr hidden constant [10 x i8] c"foo_extern" 15 16; COMMON: @__profc_foo = hidden global 17; COMMON: @__profd_foo = hidden global 18define void @foo() { 19 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) 20 ret void 21} 22 23; COMMON: @__profc_foo_weak = weak hidden global 24; COMMON: @__profd_foo_weak = weak hidden global 25define weak void @foo_weak() { 26 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) 27 ret void 28} 29 30; COMMON: @"__profc_linkage.ll:foo_internal" = internal global 31; COMMON: @"__profd_linkage.ll:foo_internal" = internal global 32define internal void @foo_internal() { 33 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) 34 ret void 35} 36 37; COMMON: @__profc_foo_inline = linkonce_odr hidden global 38; COMMON: @__profd_foo_inline = linkonce_odr hidden global 39define linkonce_odr void @foo_inline() { 40 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) 41 ret void 42} 43 44; LINUX: @__profc_foo_extern = linkonce_odr hidden global {{.*}}section "__llvm_prf_cnts", comdat($__profv_foo_extern), align 8 45; LINUX: @__profd_foo_extern = linkonce_odr hidden global {{.*}}section "__llvm_prf_data", comdat($__profv_foo_extern), align 8 46; OTHER: @__profc_foo_extern = linkonce_odr hidden global 47; OTHER: @__profd_foo_extern = linkonce_odr hidden global 48define available_externally void @foo_extern() { 49 call void @llvm.instrprof.increment(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @__profn_foo_extern, i32 0, i32 0), i64 0, i32 1, i32 0) 50 ret void 51} 52 53declare void @llvm.instrprof.increment(i8*, i64, i32, i32) 54 55; OTHER: @__llvm_profile_runtime = external global i32 56; LINUX-NOT: @__llvm_profile_runtime = external global i32 57 58; OTHER: define linkonce_odr hidden i32 @__llvm_profile_runtime_user() {{.*}} { 59; OTHER: %[[REG:.*]] = load i32, i32* @__llvm_profile_runtime 60; OTHER: ret i32 %[[REG]] 61; OTHER: } 62; COFF: define linkonce_odr hidden i32 @__llvm_profile_runtime_user() {{.*}} comdat { 63; LINUX-NOT: define linkonce_odr hidden i32 @__llvm_profile_runtime_user() {{.*}} { 64; LINUX-NOT: %[[REG:.*]] = load i32, i32* @__llvm_profile_runtime 65