diff --git a/llvm/test/Instrumentation/InstrProfiling/linkage.ll b/llvm/test/Instrumentation/InstrProfiling/linkage.ll --- a/llvm/test/Instrumentation/InstrProfiling/linkage.ll +++ b/llvm/test/Instrumentation/InstrProfiling/linkage.ll @@ -8,8 +8,10 @@ ; RUN: opt < %s -mtriple=x86_64-unknown-linux -passes=instrprof -S | FileCheck %s --check-prefixes=ELF ; RUN: opt < %s -mtriple=x86_64-unknown-fuchsia -passes=instrprof -S | FileCheck %s --check-prefixes=ELF ; RUN: opt < %s -mtriple=x86_64-pc-win32-coff -passes=instrprof -S | FileCheck %s --check-prefixes=COFF +; RUN: opt < %s -mtriple=powerpc64-ibm-aix-xcoff -passes=instrprof -S | FileCheck %s --check-prefixes=XCOFF ; MACHO: @__llvm_profile_runtime = external global i32 +; XCOFF: @__llvm_profile_runtime = external global i32 ; ELF-NOT: @__llvm_profile_runtime = external global i32 ; ELF: $__profc_foo = comdat nodeduplicate @@ -31,6 +33,10 @@ ; COFF: @__profc_foo = private global ; COFF-NOT: comdat ; COFF: @__profd_foo = private global +; XCOFF: @__profc_foo = private global +; XCOFF-NOT: comdat +; XCOFF: @__profd_foo = private global + define void @foo() { 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) ret void @@ -42,6 +48,8 @@ ; MACHO: @__profd_foo_weak = weak hidden global ; COFF: @__profc_foo_weak = weak hidden global ; COFF: @__profd_foo_weak = private global +; XCOFF: @__profc_foo_weak = weak hidden global +; XCOFF: @__profd_foo_weak = weak hidden global define weak void @foo_weak() { 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) ret void @@ -53,6 +61,8 @@ ; MACHO: @"__profd_linkage.ll:foo_internal" = private global ; COFF: @"__profc_linkage.ll:foo_internal" = private global ; COFF: @"__profd_linkage.ll:foo_internal" = private global +; XCOFF: @"__profc_linkage.ll:foo_internal" = private global +; XCOFF: @"__profd_linkage.ll:foo_internal" = private global define internal void @foo_internal() { 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) ret void @@ -64,6 +74,8 @@ ; MACHO: @__profd_foo_inline = linkonce_odr hidden global ; COFF: @__profc_foo_inline = linkonce_odr hidden global{{.*}} section ".lprfc$M", align 8 ; COFF: @__profd_foo_inline = private global{{.*}} section ".lprfd$M", align 8 +; XCOFF: @__profc_foo_inline = linkonce_odr hidden global +; XCOFF: @__profd_foo_inline = linkonce_odr hidden global define linkonce_odr void @foo_inline() { 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) ret void @@ -75,6 +87,8 @@ ; MACHO: @__profd_foo_extern = linkonce_odr hidden global ; COFF: @__profc_foo_extern = linkonce_odr hidden global {{.*}}section ".lprfc$M", comdat, align 8 ; COFF: @__profd_foo_extern = private global {{.*}}section ".lprfd$M", comdat($__profc_foo_extern), align 8 +; XCOFF: @__profc_foo_extern = linkonce_odr hidden global +; XCOFF: @__profd_foo_extern = linkonce_odr hidden global define available_externally void @foo_extern() { 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) ret void @@ -89,3 +103,7 @@ ; COFF: define linkonce_odr hidden i32 @__llvm_profile_runtime_user() {{.*}} comdat { ; ELF-NOT: define linkonce_odr hidden i32 @__llvm_profile_runtime_user() {{.*}} { ; ELF-NOT: %[[REG:.*]] = load i32, i32* @__llvm_profile_runtime +; XCOFF: define linkonce_odr hidden i32 @__llvm_profile_runtime_user() {{.*}} { +; XCOFF: %[[REG:.*]] = load i32, i32* @__llvm_profile_runtime +; XCOFF: ret i32 %[[REG]] +; XCOFF: } diff --git a/llvm/test/Instrumentation/InstrProfiling/no-counters.ll b/llvm/test/Instrumentation/InstrProfiling/no-counters.ll --- a/llvm/test/Instrumentation/InstrProfiling/no-counters.ll +++ b/llvm/test/Instrumentation/InstrProfiling/no-counters.ll @@ -3,6 +3,7 @@ ; RUN: opt < %s -mtriple=x86_64-apple-macosx10.10.0 -instrprof -S | FileCheck %s -check-prefixes=ALL,DARWIN ; RUN: opt < %s -mtriple=x86_64-apple-macosx10.10.0 -passes=instrprof -S | FileCheck %s -check-prefixes=ALL,DARWIN ; RUN: opt < %s -mtriple=x86_64-linux-unknown -passes=instrprof -S | FileCheck %s -check-prefixes=ALL,LINUX +; RUN: opt < %s -mtriple=powerpc64-ibm-aix-xcoff -passes=instrprof -S | FileCheck %s -check-prefixes=ALL,DARWIN ; ALL-NOT: @__profc ; ALL-NOT: @__profd ; DARWIN: @__llvm_profile_runtime diff --git a/llvm/test/Instrumentation/InstrProfiling/profiling.ll b/llvm/test/Instrumentation/InstrProfiling/profiling.ll --- a/llvm/test/Instrumentation/InstrProfiling/profiling.ll +++ b/llvm/test/Instrumentation/InstrProfiling/profiling.ll @@ -2,6 +2,7 @@ ; RUN: opt < %s -mtriple=x86_64-linux -passes=instrprof -S | FileCheck %s --check-prefixes=CHECK,ELF_LINUX ; RUN: opt < %s -mtriple=x86_64-apple-macosx10.10.0 -passes=instrprof -S | FileCheck %s --check-prefixes=CHECK,MACHO ; RUN: opt < %s -mtriple=x86_64-windows -passes=instrprof -S | FileCheck %s --check-prefixes=CHECK,WIN +; RUN: opt < %s -mtriple=powerpc64-ibm-aix-xcoff -passes=instrprof -S | FileCheck %s --check-prefixes=CHECK,XCOFF ; RUN: opt < %s -mtriple=x86_64-apple-macosx10.10.0 -instrprof -S | FileCheck %s @@ -9,6 +10,7 @@ ; ELF_LINUX-NOT: @__llvm_profile_runtime ; MACHO: @__llvm_profile_runtime = external global i32 ; WIN: @__llvm_profile_runtime = external global i32 +; XCOFF: @__llvm_profile_runtime = external global i32 @__profn_foo = private constant [3 x i8] c"foo" ; CHECK-NOT: __profn_foo @@ -23,6 +25,8 @@ ; MACHO: @__profd_foo = private {{.*}}, section "__DATA,__llvm_prf_data,regular,live_support", align 8 ; WIN: @__profc_foo = private global [1 x i64] zeroinitializer, section ".lprfc$M", align 8 ; WIN: @__profd_foo = private {{.*}}, section ".lprfd$M", align 8 +; XCOFF: @__profc_foo = private global [1 x i64] zeroinitializer, section "__llvm_prf_cnts", align 8 +; XCOFF: @__profd_foo = private {{.*}}, section "__llvm_prf_data", align 8 define void @foo() { 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) ret void @@ -34,6 +38,8 @@ ; MACHO: @__profd_bar = private {{.*}}, section "__DATA,__llvm_prf_data,regular,live_support", align 8 ; WIN: @__profc_bar = private global [1 x i64] zeroinitializer, section ".lprfc$M", align 8 ; WIN: @__profd_bar = private {{.*}}, section ".lprfd$M", align 8 +; XCOFF: @__profc_bar = private global [1 x i64] zeroinitializer, section "__llvm_prf_cnts", align 8 +; XCOFF: @__profd_bar = private {{.*}}, section "__llvm_prf_data", align 8 define void @bar() { call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_bar, i32 0, i32 0), i64 0, i32 1, i32 0) ret void @@ -45,6 +51,8 @@ ; MACHO: @__profd_baz = private {{.*}}, section "__DATA,__llvm_prf_data,regular,live_support", align 8 ; WIN: @__profc_baz = private global [3 x i64] zeroinitializer, section ".lprfc$M", align 8 ; WIN: @__profd_baz = private {{.*}}, section ".lprfd$M", align 8 +; XCOFF: @__profc_baz = private global [3 x i64] zeroinitializer, section "__llvm_prf_cnts", align 8 +; XCOFF: @__profd_baz = private {{.*}}, section "__llvm_prf_data", align 8 define void @baz() { call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_baz, i32 0, i32 0), i64 0, i32 3, i32 0) call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_baz, i32 0, i32 0), i64 0, i32 3, i32 1) @@ -67,4 +75,13 @@ ; ELF_GENERIC-NEXT: ret void ; ELF_GENERIC-NEXT: } +; XCOFF: define internal void @__llvm_profile_register_functions() unnamed_addr { +; XCOFF-NEXT: call void @__llvm_profile_register_function(i8* bitcast ({ i64, i64, i64, i8*, i8*, i32, [{{.*}} x i16] }* @__profd_foo to i8*)) +; XCOFF-NEXT: call void @__llvm_profile_register_function(i8* bitcast ({ i64, i64, i64, i8*, i8*, i32, [{{.*}} x i16] }* @__profd_bar to i8*)) +; XCOFF-NEXT: call void @__llvm_profile_register_function(i8* bitcast ({ i64, i64, i64, i8*, i8*, i32, [{{.*}} x i16] }* @__profd_baz to i8*)) +; XCOFF-NEXT: call void @__llvm_profile_register_names_function(i8* getelementptr inbounds {{.*}} @__llvm_prf_nm +; XCOFF-NEXT: ret void +; XCOFF-NEXT: } + + ; ELF_LINUX-NOT: @__llvm_profile_register_functions()