[compiler-rt] ac719d7 - [InstrProf] Don't profile merge by default in lightweight mode

Ellis Hoag via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 20 09:51:54 PST 2021


Author: Ellis Hoag
Date: 2021-12-20T09:51:49-08:00
New Revision: ac719d7c9ae6a20a6ae530e308331b3d51b3d70e

URL: https://github.com/llvm/llvm-project/commit/ac719d7c9ae6a20a6ae530e308331b3d51b3d70e
DIFF: https://github.com/llvm/llvm-project/commit/ac719d7c9ae6a20a6ae530e308331b3d51b3d70e.diff

LOG: [InstrProf] Don't profile merge by default in lightweight mode

Profile merging is not supported when using debug info profile
correlation because the data section won't be in the binary at runtime.
Change the default profile name in this mode to `default_%p.proflite` so
we don't use profile merging.

Reviewed By: kyulee

Differential Revision: https://reviews.llvm.org/D115979

Added: 
    

Modified: 
    clang/lib/CodeGen/BackendUtil.cpp
    compiler-rt/lib/profile/InstrProfilingMerge.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index 49a278f1a09fc..3195615ae561c 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -102,7 +102,7 @@ namespace {
 
 // Default filename used for profile generation.
 std::string getDefaultProfileGenName() {
-  return DebugInfoCorrelate ? "default_%m.proflite" : "default_%m.profraw";
+  return DebugInfoCorrelate ? "default_%p.proflite" : "default_%m.profraw";
 }
 
 class EmitAssemblyHelper {

diff  --git a/compiler-rt/lib/profile/InstrProfilingMerge.c b/compiler-rt/lib/profile/InstrProfilingMerge.c
index 6262762de0f1d..bf99521d4da7e 100644
--- a/compiler-rt/lib/profile/InstrProfilingMerge.c
+++ b/compiler-rt/lib/profile/InstrProfilingMerge.c
@@ -95,8 +95,13 @@ static uintptr_t signextIfWin64(void *V) {
 COMPILER_RT_VISIBILITY
 int __llvm_profile_merge_from_buffer(const char *ProfileData,
                                      uint64_t ProfileSize) {
-  if (__llvm_profile_get_version() & VARIANT_MASK_DBG_CORRELATE)
+  if (__llvm_profile_get_version() & VARIANT_MASK_DBG_CORRELATE) {
+    PROF_ERR(
+        "%s\n",
+        "Debug info correlation does not support profile merging at runtime. "
+        "Instead, merge raw profiles using the llvm-profdata tool.");
     return 1;
+  }
 
   __llvm_profile_data *SrcDataStart, *SrcDataEnd, *SrcData, *DstData;
   __llvm_profile_header *Header = (__llvm_profile_header *)ProfileData;


        


More information about the llvm-commits mailing list