llvm.org GIT mirror llvm / 0f324db
[profile] Fix runtime hook linkage bug for COFF Patch by: Johan Engelen the user hook has linkonceODR linkage and it needs to be in comdatAny group. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270596 91177308-0d34-0410-b5e6-96231b3b80d8 Xinliang David Li 3 years ago
2 changed file(s) with 5 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
549549 User->addFnAttr(Attribute::NoInline);
550550 if (Options.NoRedZone) User->addFnAttr(Attribute::NoRedZone);
551551 User->setVisibility(GlobalValue::HiddenVisibility);
552 if (Triple(M->getTargetTriple()).isOSBinFormatCOFF())
553 User->setComdat(M->getOrInsertComdat(User->getName()));
552554
553555 IRBuilder<> IRB(BasicBlock::Create(M->getContext(), "", User));
554556 auto *Load = IRB.CreateLoad(Var);
33 ; RUN: opt < %s -mtriple=x86_64-unknown-linux -instrprof -S | FileCheck %s --check-prefix=LINUX --check-prefix=COMMON
44 ; RUN: opt < %s -mtriple=x86_64-apple-macosx10.10.0 -passes=instrprof -S | FileCheck %s --check-prefix=OTHER --check-prefix=COMMON
55 ; RUN: opt < %s -mtriple=x86_64-unknown-linux -passes=instrprof -S | FileCheck %s --check-prefix=LINUX --check-prefix=COMMON
6 ; RUN: opt < %s -mtriple=x86_64-pc-win32-coff -instrprof -S | FileCheck %s --check-prefix=COFF
7 ; RUN: opt < %s -mtriple=x86_64-pc-win32-coff -passes=instrprof -S | FileCheck %s --check-prefix=COFF
68
79 @__profn_foo = hidden constant [3 x i8] c"foo"
810 @__profn_foo_weak = weak hidden constant [8 x i8] c"foo_weak"
5658 ; OTHER: %[[REG:.*]] = load i32, i32* @__llvm_profile_runtime
5759 ; OTHER: ret i32 %[[REG]]
5860 ; OTHER: }
61 ; COFF: define linkonce_odr hidden i32 @__llvm_profile_runtime_user() {{.*}} comdat {
5962 ; LINUX-NOT: define linkonce_odr hidden i32 @__llvm_profile_runtime_user() {{.*}} {
6063 ; LINUX-NOT: %[[REG:.*]] = load i32, i32* @__llvm_profile_runtime