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

Ellis Hoag via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 17 15:51:11 PST 2021


ellis created this revision.
Herald added a subscriber: ormris.
ellis added reviewers: kyulee, MaskRay, alanphipps.
ellis published this revision for review.
Herald added projects: clang, Sanitizers.
Herald added subscribers: Sanitizers, cfe-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115979

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


Index: compiler-rt/lib/profile/InstrProfilingMerge.c
===================================================================
--- compiler-rt/lib/profile/InstrProfilingMerge.c
+++ compiler-rt/lib/profile/InstrProfilingMerge.c
@@ -95,8 +95,10 @@
 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");
     return 1;
+  }
 
   __llvm_profile_data *SrcDataStart, *SrcDataEnd, *SrcData, *DstData;
   __llvm_profile_header *Header = (__llvm_profile_header *)ProfileData;
Index: clang/lib/CodeGen/BackendUtil.cpp
===================================================================
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -102,7 +102,7 @@
 
 // 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 {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115979.395237.patch
Type: text/x-patch
Size: 1257 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211217/ab0f4492/attachment-0001.bin>


More information about the cfe-commits mailing list