[PATCH] D127506: [PS4/PS5][profiling] Go back to the old way of doing a runtime hook
Paul Robinson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 10 09:18:45 PDT 2022
probinson created this revision.
probinson added a reviewer: phosek.
Herald added subscribers: Enna1, abrachet, hiraditya.
Herald added a project: All.
probinson requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Profiling stopped working for us after D98061 <https://reviews.llvm.org/D98061>, which was largely a
Fuschia-specific patch but in one place used `isOSBinFormatELF` to
make a decision. I'm adding a PS4/PS5 exception to that, so we can
get profiling to work again.
I'm pretty sure `isOSBinFormatELF` isn't really the right predicate,
but I'm not familiar enough with this area to say what is.
https://reviews.llvm.org/D127506
Files:
llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
llvm/test/Instrumentation/InstrProfiling/profiling.ll
Index: llvm/test/Instrumentation/InstrProfiling/profiling.ll
===================================================================
--- llvm/test/Instrumentation/InstrProfiling/profiling.ll
+++ llvm/test/Instrumentation/InstrProfiling/profiling.ll
@@ -2,8 +2,10 @@
; RUN: opt < %s -mtriple=x86_64-apple-macosx10.10.0 -passes=instrprof -S | FileCheck %s --check-prefixes=MACHO
; RUN: opt < %s -mtriple=x86_64 -passes=instrprof -S | FileCheck %s --check-prefix=ELF_GENERIC
-; RUN: opt < %s -mtriple=x86_64-unknown-linux -passes=instrprof -S | FileCheck %s --check-prefixes=ELF
-; RUN: opt < %s -mtriple=x86_64-unknown-fuchsia -passes=instrprof -S | FileCheck %s --check-prefixes=ELF
+; RUN: opt < %s -mtriple=x86_64-unknown-linux -passes=instrprof -S | FileCheck %s --check-prefixes=ELF,ELFRT
+; RUN: opt < %s -mtriple=x86_64-unknown-fuchsia -passes=instrprof -S | FileCheck %s --check-prefixes=ELF,ELFRT
+; RUN: opt < %s -mtriple=x86_64-scei-ps4 -passes=instrprof -S | FileCheck %s --check-prefixes=ELF,PS
+; RUN: opt < %s -mtriple=x86_64-sie-ps5 -passes=instrprof -S | FileCheck %s --check-prefixes=ELF,PS
; RUN: opt < %s -mtriple=x86_64-pc-win32-coff -passes=instrprof -S | FileCheck %s --check-prefixes=COFF
; RUN: opt < %s -mtriple=powerpc64-ibm-aix-xcoff -passes=instrprof -S | FileCheck %s --check-prefixes=XCOFF
@@ -104,8 +106,10 @@
; MACHO: ret i32 %[[REG]]
; MACHO: }
; COFF: define linkonce_odr hidden i32 @__llvm_profile_runtime_user() {{.*}} comdat {
-; ELF-NOT: define linkonce_odr hidden i32 @__llvm_profile_runtime_user() {{.*}} {
-; ELF-NOT: %[[REG:.*]] = load i32, i32* @__llvm_profile_runtime
+; ELFRT-NOT: define linkonce_odr hidden i32 @__llvm_profile_runtime_user() {{.*}} {
+; ELFRT-NOT: %[[REG:.*]] = load i32, i32* @__llvm_profile_runtime
+; PS: define linkonce_odr hidden i32 @__llvm_profile_runtime_user() {{.*}} {
+; PS: %[[REG:.*]] = load i32, i32* @__llvm_profile_runtime
; XCOFF: define linkonce_odr hidden i32 @__llvm_profile_runtime_user() {{.*}} {
; XCOFF: %[[REG:.*]] = load i32, i32* @__llvm_profile_runtime
; XCOFF: ret i32 %[[REG]]
Index: llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
+++ llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
@@ -1246,7 +1246,7 @@
new GlobalVariable(*M, Int32Ty, false, GlobalValue::ExternalLinkage,
nullptr, getInstrProfRuntimeHookVarName());
- if (TT.isOSBinFormatELF()) {
+ if (TT.isOSBinFormatELF() && !TT.isPS()) {
// Mark the user variable as used so that it isn't stripped out.
CompilerUsedVars.push_back(Var);
} else {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127506.435938.patch
Type: text/x-patch
Size: 2708 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220610/9589e8fe/attachment.bin>
More information about the llvm-commits
mailing list