mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 11:02:59 +02:00
[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. llvm-svn: 270596
This commit is contained in:
parent
751b460b85
commit
6976ddd1e6
@ -550,6 +550,8 @@ void InstrProfiling::emitRuntimeHook() {
|
||||
User->addFnAttr(Attribute::NoInline);
|
||||
if (Options.NoRedZone) User->addFnAttr(Attribute::NoRedZone);
|
||||
User->setVisibility(GlobalValue::HiddenVisibility);
|
||||
if (Triple(M->getTargetTriple()).isOSBinFormatCOFF())
|
||||
User->setComdat(M->getOrInsertComdat(User->getName()));
|
||||
|
||||
IRBuilder<> IRB(BasicBlock::Create(M->getContext(), "", User));
|
||||
auto *Load = IRB.CreateLoad(Var);
|
||||
|
@ -4,6 +4,8 @@
|
||||
; RUN: opt < %s -mtriple=x86_64-unknown-linux -instrprof -S | FileCheck %s --check-prefix=LINUX --check-prefix=COMMON
|
||||
; RUN: opt < %s -mtriple=x86_64-apple-macosx10.10.0 -passes=instrprof -S | FileCheck %s --check-prefix=OTHER --check-prefix=COMMON
|
||||
; RUN: opt < %s -mtriple=x86_64-unknown-linux -passes=instrprof -S | FileCheck %s --check-prefix=LINUX --check-prefix=COMMON
|
||||
; RUN: opt < %s -mtriple=x86_64-pc-win32-coff -instrprof -S | FileCheck %s --check-prefix=COFF
|
||||
; RUN: opt < %s -mtriple=x86_64-pc-win32-coff -passes=instrprof -S | FileCheck %s --check-prefix=COFF
|
||||
|
||||
@__profn_foo = hidden constant [3 x i8] c"foo"
|
||||
@__profn_foo_weak = weak hidden constant [8 x i8] c"foo_weak"
|
||||
@ -57,5 +59,6 @@ declare void @llvm.instrprof.increment(i8*, i64, i32, i32)
|
||||
; OTHER: %[[REG:.*]] = load i32, i32* @__llvm_profile_runtime
|
||||
; OTHER: ret i32 %[[REG]]
|
||||
; OTHER: }
|
||||
; COFF: define linkonce_odr hidden i32 @__llvm_profile_runtime_user() {{.*}} comdat {
|
||||
; LINUX-NOT: define linkonce_odr hidden i32 @__llvm_profile_runtime_user() {{.*}} {
|
||||
; LINUX-NOT: %[[REG:.*]] = load i32, i32* @__llvm_profile_runtime
|
||||
|
Loading…
Reference in New Issue
Block a user