#define INSTR_PROF_DATA(Type, LLVMType, Name, Init) Init,
#include "llvm/ProfileData/InstrProfData.inc"
};
- // If linker GC cannot discard data variables while the text section is
- // retained, data variables can be private. This optimization applies on ELF.
- // On COFF, when DataReferencedByCode is false, __profd_ is never a comdat
- // leader, this is applicable as well.
- if (TT.isOSBinFormatELF() ||
- (!DataReferencedByCode && TT.isOSBinFormatCOFF())) {
+ // If code never references data variables (the symbol is unneeded), and
+ // linker GC cannot discard data variables while the text section is retained,
+ // data variables can be private. This optimization applies on COFF and ELF.
+ if (!DataReferencedByCode && !TT.isOSBinFormatMachO()) {
Linkage = GlobalValue::PrivateLinkage;
Visibility = GlobalValue::DefaultVisibility;
}
}
; Test that comdat function's address is recorded.
-; LOWER: @__profd_foo3.[[FOO3_HASH:[0-9]+]] = private {{.*}} @__profc_foo3.[[FOO3_HASH]]
+; LOWER: @__profd_foo3.[[FOO3_HASH:[0-9]+]] = linkonce_odr{{.*}}@__profc_foo3.[[FOO3_HASH]]
; Function Attrs: nounwind uwtable
define linkonce_odr i32 @foo3() comdat {
ret i32 1