diff --git a/compiler-rt/test/profile/Linux/coverage-linkage-lld.cpp b/compiler-rt/test/profile/Linux/coverage-linkage-lld.cpp new file mode 100644 --- /dev/null +++ b/compiler-rt/test/profile/Linux/coverage-linkage-lld.cpp @@ -0,0 +1,7 @@ +// REQUIRES: lld-available +/// With lld we can ensure discarded[01] and their profc/profd variables are discarded. + +// RUN: %clang_profgen -fcoverage-mapping -ffunction-sections -fuse-ld=lld -Wl,--gc-sections %S/coverage-linkage.cpp -o %t +// RUN: llvm-nm %t | FileCheck %s + +// CHECK-NOT: discarded{{.*}} diff --git a/compiler-rt/test/profile/Linux/coverage-linkage.cpp b/compiler-rt/test/profile/Linux/coverage-linkage.cpp new file mode 100644 --- /dev/null +++ b/compiler-rt/test/profile/Linux/coverage-linkage.cpp @@ -0,0 +1,46 @@ +/// Test instrumentation can handle various linkages. +// RUN: %clang_profgen -fcoverage-mapping %s -o %t +// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t +// RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s + +// RUN: %clang_profgen -fcoverage-mapping -ffunction-sections -Wl,--gc-sections %s -o %t +// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t +// RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s + +// CHECK: {{.*}}external{{.*}}: +// CHECK-NEXT: Hash: +// CHECK-NEXT: Counters: 1 +// CHECK-NEXT: Function count: 1 +// CHECK: {{.*}}weak{{.*}}: +// CHECK-NEXT: Hash: +// CHECK-NEXT: Counters: 1 +// CHECK-NEXT: Function count: 1 +// CHECK: main: +// CHECK-NEXT: Hash: +// CHECK-NEXT: Counters: 1 +// CHECK-NEXT: Function count: 1 +// CHECK: {{.*}}internal{{.*}}: +// CHECK-NEXT: Hash: +// CHECK-NEXT: Counters: 1 +// CHECK-NEXT: Function count: 1 +// CHECK: {{.*}}inline_{{.*}}: +// CHECK-NEXT: Hash: +// CHECK-NEXT: Counters: 1 +// CHECK-NEXT: Function count: 1 + +#include + +void discarded0() {} +__attribute__((weak)) void discarded1() {} + +void external() { puts("external"); } +__attribute__((weak)) void weak() { puts("weak"); } +static void internal() { puts("internal"); } +__attribute__((noinline)) inline void inline_() { puts("inline"); } + +int main() { + internal(); + external(); + weak(); + inline_(); +} diff --git a/compiler-rt/test/profile/Linux/coverage-weak-lld.cpp b/compiler-rt/test/profile/Linux/coverage-weak-lld.cpp new file mode 100644 --- /dev/null +++ b/compiler-rt/test/profile/Linux/coverage-weak-lld.cpp @@ -0,0 +1,103 @@ +// REQUIRES: lld-available + +// RUN: %clang_profgen -fcoverage-mapping -c %s -o %t0.o +// RUN: %clang_profgen -fcoverage-mapping -c %s -DOBJ_1 -o %t1.o +// RUN: %clang_profgen -fcoverage-mapping -c %s -DOBJ_2 -o %t2.o + +/// An external symbol can override a weak external symbol. +// RUN: %clang_profgen -fcoverage-mapping -fuse-ld=lld %t0.o %t1.o -o %t1 +// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t1 | FileCheck %s --check-prefix=CHECK1 +// RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s --check-prefix=PROFILE1_NOGC +// RUN: %clang_profgen -fcoverage-mapping -fuse-ld=lld -Wl,--gc-sections %t0.o %t1.o -o %t1 +// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t1 | FileCheck %s --check-prefix=CHECK1 +// RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s --check-prefix=PROFILE1_NOGC + +// RUN: %clang_profgen -fcoverage-mapping -fuse-ld=lld %t0.o %t2.o -o %t2 +// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t2 | FileCheck %s --check-prefix=CHECK2 +// RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s --check-prefix=PROFILE2_NOGC +// RUN: %clang_profgen -fcoverage-mapping -fuse-ld=lld -Wl,--gc-sections %t0.o %t2.o -o %t2 +// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t2 | FileCheck %s --check-prefix=CHECK2 +// RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s --check-prefix=PROFILE2_GC + +/// Repeat the above tests with -ffunction-sections. +// RUN: %clang_profgen -fcoverage-mapping -ffunction-sections -c %s -o %t0.o +// RUN: %clang_profgen -fcoverage-mapping -ffunction-sections -c %s -DOBJ_1 -o %t1.o +// RUN: %clang_profgen -fcoverage-mapping -ffunction-sections -c %s -DOBJ_2 -o %t2.o + +// RUN: %clang_profgen -fcoverage-mapping -fuse-ld=lld %t0.o %t1.o -o %t1 +// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t1 | FileCheck %s --check-prefix=CHECK1 +// RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s --check-prefix=PROFILE1_NOGC +// RUN: %clang_profgen -fcoverage-mapping -fuse-ld=lld -Wl,--gc-sections %t0.o %t1.o -o %t1 +// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t1 | FileCheck %s --check-prefix=CHECK1 +// RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s --check-prefix=PROFILE1_GC + +// RUN: %clang_profgen -fcoverage-mapping -fuse-ld=lld %t0.o %t2.o -o %t2 +// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t2 | FileCheck %s --check-prefix=CHECK2 +// RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s --check-prefix=PROFILE2_NOGC +// RUN: %clang_profgen -fcoverage-mapping -fuse-ld=lld -Wl,--gc-sections %t0.o %t2.o -o %t2 +// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t2 | FileCheck %s --check-prefix=CHECK2 +// RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s --check-prefix=PROFILE2_GC + +// CHECK1: strong +// CHECK1: strong + +/// __profc__Z4weakv in %t1.o is local and has a zero value. +/// Without GC it takes a duplicate entry. +// PROFILE1_NOGC: _Z4weakv: +// PROFILE1_NOGC-NEXT: Hash: +// PROFILE1_NOGC-NEXT: Counters: 1 +// PROFILE1_NOGC-NEXT: Function count: 0 +// PROFILE1_NOGC: _Z4weakv: +// PROFILE1_NOGC-NEXT: Hash: +// PROFILE1_NOGC-NEXT: Counters: 1 +// PROFILE1_NOGC-NEXT: Function count: 2 + +// PROFILE1_GC: _Z4weakv: +// PROFILE1_GC-NEXT: Hash: +// PROFILE1_GC-NEXT: Counters: 1 +// PROFILE1_GC-NEXT: Function count: 2 +// PROFILE1_GC-NOT: _Z4weakv: + +// CHECK2: weak +// CHECK2: weak + +/// __profc__Z4weakv in %t2.o is weak and resolves to the value of %t0.o's copy. +/// Without GC it takes a duplicate entry. +// PROFILE2_NOGC: _Z4weakv: +// PROFILE2_NOGC-NEXT: Hash: +// PROFILE2_NOGC-NEXT: Counters: 1 +// PROFILE2_NOGC-NEXT: Function count: 2 +// PROFILE2_NOGC: _Z4weakv: +// PROFILE2_NOGC-NEXT: Hash: +// PROFILE2_NOGC-NEXT: Counters: 1 +// PROFILE2_NOGC-NEXT: Function count: 2 + +// PROFILE2_GC: _Z4weakv: +// PROFILE2_GC-NEXT: Hash: +// PROFILE2_GC-NEXT: Counters: 1 +// PROFILE2_GC-NEXT: Function count: 2 +// PROFILE2_GC-NOT: _Z4weakv: + +#ifdef OBJ_1 +#include + +void weak() { puts("strong"); } +void foo() { weak(); } + +#elif defined(OBJ_2) +#include + +__attribute__((weak)) void weak() { puts("unreachable"); } +void foo() { weak(); } + +#else +#include + +__attribute__((weak)) void weak() { puts("weak"); } +void foo(); + +int main() { + foo(); + weak(); +} +#endif diff --git a/compiler-rt/test/profile/Windows/coverage-linkage-lld.cpp b/compiler-rt/test/profile/Windows/coverage-linkage-lld.cpp new file mode 100644 --- /dev/null +++ b/compiler-rt/test/profile/Windows/coverage-linkage-lld.cpp @@ -0,0 +1,10 @@ +// REQUIRES: lld-available +/// With lld we can ensure discarded[01] and their profc/profd variables are discarded. + +// RUN: %clang_profgen -fcoverage-mapping -ffunction-sections -fuse-ld=lld -Wl,-debug:symtab,-opt:noref %S/coverage-linkage.cpp -o %t +// RUN: llvm-nm %t | FileCheck %s --check-prefix=NOGC +// RUN: %clang_profgen -fcoverage-mapping -ffunction-sections -fuse-ld=lld -Wl,-debug:symtab,-opt:ref %S/coverage-linkage.cpp -o %t +// RUN: llvm-nm %t | FileCheck %s --check-prefix=GC + +// NOGC: T ?discarded{{.*}} +// GC-NOT: T ?discarded{{.*}} diff --git a/compiler-rt/test/profile/Windows/coverage-linkage.cpp b/compiler-rt/test/profile/Windows/coverage-linkage.cpp new file mode 100644 --- /dev/null +++ b/compiler-rt/test/profile/Windows/coverage-linkage.cpp @@ -0,0 +1,46 @@ +/// Test instrumentation can handle various linkages. +// RUN: %clang_profgen -fcoverage-mapping %s -o %t +// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t +// RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s + +// RUN: %clang_profgen -fcoverage-mapping -ffunction-sections -Wl,-opt:ref %s -o %t +// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t +// RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s + +// CHECK: {{.*}}external{{.*}}: +// CHECK-NEXT: Hash: +// CHECK-NEXT: Counters: 1 +// CHECK-NEXT: Function count: 1 +// CHECK: {{.*}}weak{{.*}}: +// CHECK-NEXT: Hash: +// CHECK-NEXT: Counters: 1 +// CHECK-NEXT: Function count: 1 +// CHECK: main: +// CHECK-NEXT: Hash: +// CHECK-NEXT: Counters: 1 +// CHECK-NEXT: Function count: 1 +// CHECK: {{.*}}internal{{.*}}: +// CHECK-NEXT: Hash: +// CHECK-NEXT: Counters: 1 +// CHECK-NEXT: Function count: 1 +// CHECK: {{.*}}inline_{{.*}}: +// CHECK-NEXT: Hash: +// CHECK-NEXT: Counters: 1 +// CHECK-NEXT: Function count: 1 + +#include + +void discarded0() {} +__attribute__((weak)) void discarded1() {} + +void external() { puts("external"); } +__attribute__((weak)) void weak() { puts("weak"); } +static void internal() { puts("internal"); } +__attribute__((noinline)) inline void inline_() { puts("inline"); } + +int main() { + internal(); + external(); + weak(); + inline_(); +} diff --git a/compiler-rt/test/profile/Windows/coverage-weak-lld.cpp b/compiler-rt/test/profile/Windows/coverage-weak-lld.cpp new file mode 100644 --- /dev/null +++ b/compiler-rt/test/profile/Windows/coverage-weak-lld.cpp @@ -0,0 +1,87 @@ +// REQUIRES: lld-available + +// RUN: %clang_profgen -fcoverage-mapping -c %s -o %t0.o +// RUN: %clang_profgen -fcoverage-mapping -c %s -DOBJ_1 -o %t1.o +// RUN: %clang_profgen -fcoverage-mapping -c %s -DOBJ_2 -o %t2.o + +/// An external symbol can override a weak external symbol. +// RUN: %clang_profgen -fcoverage-mapping -fuse-ld=lld -Wl,-opt:noref %t0.o %t1.o -o %t1 +// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t1 | FileCheck %s --check-prefix=CHECK1 +// RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s --check-prefix=PROFILE1 +// RUN: %clang_profgen -fcoverage-mapping -fuse-ld=lld -Wl,-opt:ref %t0.o %t1.o -o %t1 +// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t1 | FileCheck %s --check-prefix=CHECK1 +// RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s --check-prefix=PROFILE1 + +/// link.exe does not support weak overridding weak. +// RUN: %clang_profgen -fcoverage-mapping -fuse-ld=lld -Wl,-lldmingw,-opt:ref %t0.o %t2.o -o %t2 +// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t2 | FileCheck %s --check-prefix=CHECK2 +// RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s --check-prefix=PROFILE2 + +/// Repeat the above tests with -ffunction-sections (associative comdat). +// RUN: %clang_profgen -fcoverage-mapping -ffunction-sections -c %s -o %t0.o +// RUN: %clang_profgen -fcoverage-mapping -ffunction-sections -c %s -DOBJ_1 -o %t1.o +// RUN: %clang_profgen -fcoverage-mapping -ffunction-sections -c %s -DOBJ_2 -o %t2.o + +// RUN: %clang_profgen -fcoverage-mapping -fuse-ld=lld -Wl,-opt:noref %t0.o %t1.o -o %t1 +// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t1 | FileCheck %s --check-prefix=CHECK1 +// RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s --check-prefix=PROFILE1 +// RUN: %clang_profgen -fcoverage-mapping -fuse-ld=lld -Wl,-opt:ref %t0.o %t1.o -o %t1 +// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t1 | FileCheck %s --check-prefix=CHECK1 +// RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s --check-prefix=PROFILE1 + +// RUN: %clang_profgen -fcoverage-mapping -fuse-ld=lld -Wl,-lldmingw,-opt:ref %t0.o %t2.o -o %t2 +// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t2 | FileCheck %s --check-prefix=CHECK2 +// RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s --check-prefix=PROFILE2 + +// CHECK1: strong +// CHECK1: strong + +/// Document the current behavior: +/// __profc_?weak@@YAXXZ in %t1.o is local and has a zero value. +/// Without GC it takes a duplicate entry. +// PROFILE1: ?weak@@YAXXZ: +// PROFILE1-NEXT: Hash: +// PROFILE1-NEXT: Counters: 1 +// PROFILE1-NEXT: Function count: 0 +// PROFILE1: ?weak@@YAXXZ: +// PROFILE1-NEXT: Hash: +// PROFILE1-NEXT: Counters: 1 +// PROFILE1-NEXT: Function count: 2 + +// CHECK2: weak +// CHECK2: weak + +/// __profc__Z4weakv in %t2.o is weak and resolves to the value of %t0.o's copy. +/// Without GC it takes a duplicate entry. +// PROFILE2: ?weak@@YAXXZ: +// PROFILE2-NEXT: Hash: +// PROFILE2-NEXT: Counters: 1 +// PROFILE2-NEXT: Function count: 2 +// PROFILE2: ?weak@@YAXXZ: +// PROFILE2-NEXT: Hash: +// PROFILE2-NEXT: Counters: 1 +// PROFILE2-NEXT: Function count: 2 + +#ifdef OBJ_1 +#include + +void weak() { puts("strong"); } +void foo() { weak(); } + +#elif defined(OBJ_2) +#include + +__attribute__((weak)) void weak() { puts("unreachable"); } +void foo() { weak(); } + +#else +#include + +__attribute__((weak)) void weak() { puts("weak"); } +void foo(); + +int main() { + foo(); + weak(); +} +#endif diff --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp --- a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp @@ -821,15 +821,10 @@ PD = It->second; } - // Match the linkage and visibility of the name global. COFF supports using - // comdats with internal symbols, so do that if we can. + // Match the linkage and visibility of the name global. Function *Fn = Inc->getParent()->getParent(); GlobalValue::LinkageTypes Linkage = NamePtr->getLinkage(); GlobalValue::VisibilityTypes Visibility = NamePtr->getVisibility(); - if (TT.isOSBinFormatCOFF()) { - Linkage = GlobalValue::InternalLinkage; - Visibility = GlobalValue::DefaultVisibility; - } // Move the name variable to the right section. Place them in a COMDAT group // if the associated function is a COMDAT. This will make sure that only one @@ -838,23 +833,19 @@ // new comdat group for the counters and profiling data. If we use the comdat // of the parent function, that will result in relocations against discarded // sections. + // + // For COFF, put the counters, data, and values each into their own + // comdats. We can't use a group because the Visual C++ linker will + // report duplicate symbol errors if there are multiple external symbols + // with the same name marked IMAGE_COMDAT_SELECT_ASSOCIATIVE. + // + // For ELF, when not using COMDAT, put counters, data and values into a + // noduplicates COMDAT which is lowered to a zero-flag section group. This + // allows -z start-stop-gc to discard the entire group when the function is + // discarded. bool NeedComdat = needsComdatForCounter(*Fn, *M); - if (NeedComdat) { - if (TT.isOSBinFormatCOFF()) { - // For COFF, put the counters, data, and values each into their own - // comdats. We can't use a group because the Visual C++ linker will - // report duplicate symbol errors if there are multiple external symbols - // with the same name marked IMAGE_COMDAT_SELECT_ASSOCIATIVE. - Linkage = GlobalValue::LinkOnceODRLinkage; - Visibility = GlobalValue::HiddenVisibility; - } - } std::string DataVarName = getVarName(Inc, getInstrProfDataVarPrefix()); auto MaybeSetComdat = [=](GlobalVariable *GV) { - // For ELF, when not using COMDAT, put counters, data and values into - // a noduplicates COMDAT which is lowered to a zero-flag section group. - // This allows linker GC to discard the entire group when the function - // is discarded. bool UseComdat = (NeedComdat || TT.isOSBinFormatELF()); if (UseComdat) { auto GroupName = TT.isOSBinFormatCOFF() ? GV->getName() : DataVarName; 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 @@ -28,9 +28,9 @@ ; ELF: @__profd_foo = private global {{.*}} section "__llvm_prf_data", comdat, align 8 ; MACHO: @__profc_foo = private global ; MACHO: @__profd_foo = private global -; COFF: @__profc_foo = internal global +; COFF: @__profc_foo = private global ; COFF-NOT: comdat -; COFF: @__profd_foo = internal global +; COFF: @__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 @@ -40,8 +40,8 @@ ; ELF: @__profd_foo_weak = weak hidden global {{.*}} section "__llvm_prf_data", comdat, align 8 ; MACHO: @__profc_foo_weak = weak hidden global ; MACHO: @__profd_foo_weak = weak hidden global -; COFF: @__profc_foo_weak = internal global -; COFF: @__profd_foo_weak = internal global +; COFF: @__profc_foo_weak = weak hidden global +; COFF: @__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 @@ -51,8 +51,8 @@ ; ELF: @"__profd_linkage.ll:foo_internal" = private global {{.*}} section "__llvm_prf_data", comdat, align 8 ; MACHO: @"__profc_linkage.ll:foo_internal" = private global ; MACHO: @"__profd_linkage.ll:foo_internal" = private global -; COFF: @"__profc_linkage.ll:foo_internal" = internal global -; COFF: @"__profd_linkage.ll:foo_internal" = internal global +; COFF: @"__profc_linkage.ll:foo_internal" = private global +; COFF: @"__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 @@ -62,8 +62,8 @@ ; ELF: @__profd_foo_inline = linkonce_odr hidden global {{.*}} section "__llvm_prf_data", comdat, align 8 ; MACHO: @__profc_foo_inline = linkonce_odr hidden global ; MACHO: @__profd_foo_inline = linkonce_odr hidden global -; COFF: @__profc_foo_inline = internal global{{.*}} section ".lprfc$M", align 8 -; COFF: @__profd_foo_inline = internal global{{.*}} section ".lprfd$M", align 8 +; COFF: @__profc_foo_inline = linkonce_odr hidden global{{.*}} section ".lprfc$M", align 8 +; COFF: @__profd_foo_inline = linkonce_odr hidden global{{.*}} section ".lprfd$M", align 8 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 diff --git a/llvm/test/Instrumentation/InstrProfiling/platform.ll b/llvm/test/Instrumentation/InstrProfiling/platform.ll --- a/llvm/test/Instrumentation/InstrProfiling/platform.ll +++ b/llvm/test/Instrumentation/InstrProfiling/platform.ll @@ -20,11 +20,11 @@ ; MACHO: @__profc_foo = private global [1 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8 ; ELF: @__profc_foo = private global [1 x i64] zeroinitializer, section "__llvm_prf_cnts", comdat($__profd_foo), align 8 -; WINDOWS: @__profc_foo = internal global [1 x i64] zeroinitializer, section ".lprfc$M", align 8 +; WINDOWS: @__profc_foo = private global [1 x i64] zeroinitializer, section ".lprfc$M", align 8 ; MACHO: @__profd_foo = private {{.*}}, section "__DATA,__llvm_prf_data,regular,live_support", align 8 ; ELF: @__profd_foo = private {{.*}}, section "__llvm_prf_data", comdat, align 8 -; WINDOWS: @__profd_foo = internal global {{.*}}, section ".lprfd$M", align 8 +; WINDOWS: @__profd_foo = private global {{.*}}, section ".lprfd$M", align 8 ; ELF: @__llvm_prf_nm = private constant [{{.*}} x i8] c"{{.*}}", section "{{.*}}__llvm_prf_names", align 1 ; WINDOWS: @__llvm_prf_nm = private constant [{{.*}} x i8] c"{{.*}}", section "{{.*}}lprfn$M", align 1 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 @@ -21,8 +21,8 @@ ; ELF: @__profd_foo = private {{.*}}, section "__llvm_prf_data", comdat, align 8 ; MACHO: @__profc_foo = private global [1 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8 ; MACHO: @__profd_foo = private {{.*}}, section "__DATA,__llvm_prf_data,regular,live_support", align 8 -; WIN: @__profc_foo = internal global [1 x i64] zeroinitializer, section ".lprfc$M", align 8 -; WIN: @__profd_foo = internal {{.*}}, section ".lprfd$M", 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 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 @@ -32,8 +32,8 @@ ; ELF: @__profd_bar = private {{.*}}, section "__llvm_prf_data", comdat, align 8 ; MACHO: @__profc_bar = private global [1 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8 ; MACHO: @__profd_bar = private {{.*}}, section "__DATA,__llvm_prf_data,regular,live_support", align 8 -; WIN: @__profc_bar = internal global [1 x i64] zeroinitializer, section ".lprfc$M", align 8 -; WIN: @__profd_bar = internal {{.*}}, section ".lprfd$M", 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 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 @@ -43,8 +43,8 @@ ; ELF: @__profd_baz = private {{.*}}, section "__llvm_prf_data", comdat, align 8 ; MACHO: @__profc_baz = private global [3 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8 ; MACHO: @__profd_baz = private {{.*}}, section "__DATA,__llvm_prf_data,regular,live_support", align 8 -; WIN: @__profc_baz = internal global [3 x i64] zeroinitializer, section ".lprfc$M", align 8 -; WIN: @__profd_baz = internal {{.*}}, section ".lprfd$M", 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 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)