forked from OSchip/llvm-project
[PGO] Use multiple comdat groups for COFF
D84723 caused multiple definition issues (related to comdat) on Windows: http://lab.llvm.org:8011/builders/sanitizer-windows/builds/67465
This commit is contained in:
parent
6bc7ea2d8d
commit
b959906cb9
|
@ -885,7 +885,8 @@ InstrProfiling::getOrCreateRegionCounters(InstrProfIncrementInst *Inc) {
|
|||
std::string DataVarName = getVarName(Inc, getInstrProfDataVarPrefix());
|
||||
auto MaybeSetComdat = [=](GlobalVariable *GV) {
|
||||
if (NeedComdat)
|
||||
GV->setComdat(M->getOrInsertComdat(DataVarName));
|
||||
GV->setComdat(M->getOrInsertComdat(TT.isOSBinFormatCOFF() ? GV->getName()
|
||||
: DataVarName));
|
||||
};
|
||||
|
||||
uint64_t NumCounters = Inc->getNumCounters()->getZExtValue();
|
||||
|
|
|
@ -20,7 +20,7 @@ $_Z3barIvEvv = comdat any
|
|||
|
||||
|
||||
; COFF-NOT: __profn__Z3barIvEvv
|
||||
; COFF: @__profc__Z3barIvEvv = linkonce_odr hidden global [1 x i64] zeroinitializer, section "{{.*}}prfc$M", comdat($__profd__Z3barIvEvv), align 8
|
||||
; COFF: @__profc__Z3barIvEvv = linkonce_odr hidden global [1 x i64] zeroinitializer, section "{{.*}}prfc$M", comdat, align 8
|
||||
; COFF: @__profd__Z3barIvEvv = linkonce_odr hidden global { i64, i64, i64*, i8*, i8*, i32, [2 x i16] } { i64 4947693190065689389, i64 0, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc__Z3barIvEvv, i32 0, i32 0), i8*{{.*}}, i8* null, i32 1, [2 x i16] zeroinitializer }, section "{{.*}}prfd{{.*}}", comdat, align 8
|
||||
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ $foo_inline = comdat any
|
|||
|
||||
; ELF: @__profc_foo_inline = linkonce_odr hidden global{{.*}}, section "__llvm_prf_cnts", comdat($__profd_foo_inline), align 8
|
||||
; ELF: @__profd_foo_inline = linkonce_odr hidden global{{.*}}, section "__llvm_prf_data", comdat, align 8
|
||||
; COFF: @__profc_foo_inline = linkonce_odr hidden global{{.*}}, section ".lprfc$M", comdat($__profd_foo_inline), align 8
|
||||
; COFF: @__profc_foo_inline = linkonce_odr hidden global{{.*}}, section ".lprfc$M", comdat, align 8
|
||||
; COFF: @__profd_foo_inline = linkonce_odr hidden global{{.*}}, section ".lprfd$M", comdat, align 8
|
||||
define weak_odr void @foo_inline() comdat {
|
||||
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)
|
||||
|
@ -30,7 +30,7 @@ $foo_extern = comdat any
|
|||
|
||||
; ELF: @__profc_foo_extern = linkonce_odr hidden global{{.*}}, section "__llvm_prf_cnts", comdat($__profd_foo_extern), align 8
|
||||
; ELF: @__profd_foo_extern = linkonce_odr hidden global{{.*}}, section "__llvm_prf_data", comdat, align 8
|
||||
; COFF: @__profc_foo_extern = linkonce_odr hidden global{{.*}}, section ".lprfc$M", comdat($__profd_foo_extern), align 8
|
||||
; COFF: @__profc_foo_extern = linkonce_odr hidden global{{.*}}, section ".lprfc$M", comdat, align 8
|
||||
; COFF: @__profd_foo_extern = linkonce_odr hidden global{{.*}}, section ".lprfd$M", comdat, align 8
|
||||
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)
|
||||
|
|
|
@ -59,7 +59,7 @@ define linkonce_odr void @foo_inline() {
|
|||
; LINUX: @__profd_foo_extern = linkonce_odr hidden global {{.*}}section "__llvm_prf_data", comdat, align 8
|
||||
; MACHO: @__profc_foo_extern = linkonce_odr hidden global
|
||||
; MACHO: @__profd_foo_extern = linkonce_odr hidden global
|
||||
; COFF: @__profc_foo_extern = linkonce_odr hidden global {{.*}}section ".lprfc$M", comdat($__profd_foo_extern), align 8
|
||||
; COFF: @__profc_foo_extern = linkonce_odr hidden global {{.*}}section ".lprfc$M", comdat, align 8
|
||||
; COFF: @__profd_foo_extern = linkonce_odr hidden global {{.*}}section ".lprfd$M", comdat, align 8
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue