[clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 18 11:37:37 PDT 2023


github-actions[bot] wrote:


<!--LLVM CODE FORMAT COMMENT: {clang-format}-->

:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff c9b7d21dc577b10dce2b8d67b86b279cfc374d40 c5cca07062572077c4140b4eb9a4bdbb22a385a6 -- clang/test/CodeGen/coverage-profile-raw-version.c compiler-rt/test/profile/instrprof-binary-correlate.c clang/lib/CodeGen/BackendUtil.cpp clang/lib/CodeGen/CoverageMappingGen.cpp compiler-rt/lib/profile/InstrProfiling.h compiler-rt/lib/profile/InstrProfilingBuffer.c compiler-rt/lib/profile/InstrProfilingMerge.c compiler-rt/lib/profile/InstrProfilingPlatformWindows.c compiler-rt/lib/profile/InstrProfilingWriter.c compiler-rt/test/profile/Darwin/instrprof-debug-info-correlate.c compiler-rt/test/profile/Linux/instrprof-debug-info-correlate-warnings.c compiler-rt/test/profile/Linux/instrprof-debug-info-correlate.c compiler-rt/test/profile/Linux/instrprof-show-debug-info-correlation.c llvm/include/llvm/ProfileData/InstrProf.h llvm/include/llvm/ProfileData/InstrProfCorrelator.h llvm/include/llvm/ProfileData/InstrProfReader.h llvm/include/llvm/Transforms/Instrumentation/PGOInstrumentation.h llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp llvm/lib/ProfileData/InstrProf.cpp llvm/lib/ProfileData/InstrProfCorrelator.cpp llvm/lib/ProfileData/InstrProfReader.cpp llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp llvm/tools/llvm-profdata/llvm-profdata.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index dad3c9a145b5..69692c28b16c 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -56,6 +56,7 @@
 #include "llvm/Target/TargetOptions.h"
 #include "llvm/TargetParser/SubtargetFeature.h"
 #include "llvm/TargetParser/Triple.h"
+#include "llvm/Transforms/HipStdPar/HipStdPar.h"
 #include "llvm/Transforms/IPO/EmbedBitcodePass.h"
 #include "llvm/Transforms/IPO/LowerTypeTests.h"
 #include "llvm/Transforms/IPO/ThinLTOBitcodeWriter.h"
@@ -79,7 +80,6 @@
 #include "llvm/Transforms/Scalar/EarlyCSE.h"
 #include "llvm/Transforms/Scalar/GVN.h"
 #include "llvm/Transforms/Scalar/JumpThreading.h"
-#include "llvm/Transforms/HipStdPar/HipStdPar.h"
 #include "llvm/Transforms/Utils/Debugify.h"
 #include "llvm/Transforms/Utils/EntryExitInstrumenter.h"
 #include "llvm/Transforms/Utils/ModuleUtils.h"
diff --git a/compiler-rt/test/profile/instrprof-binary-correlate.c b/compiler-rt/test/profile/instrprof-binary-correlate.c
index bc05dbd99b82..d921c4c5dcb0 100644
--- a/compiler-rt/test/profile/instrprof-binary-correlate.c
+++ b/compiler-rt/test/profile/instrprof-binary-correlate.c
@@ -7,14 +7,14 @@
 // With -profile-correlate=binary flag
 // RUN: %clang -o %t-1.exe -fprofile-instr-generate -fcoverage-mapping -mllvm -profile-correlate=binary -fuse-ld=lld %S/Inputs/instrprof-debug-info-correlate-main.cpp %S/Inputs/instrprof-debug-info-correlate-foo.cpp
 // RUN: env LLVM_PROFILE_FILE=%t-1.profraw %run %t-1.exe
-// RUN: llvm-profdata merge -o %t-1.profdata --binary-file=%t-1.exe %t-1.profraw 
-// RUN: diff %t.normal.profdata %t-1.profdata 
+// RUN: llvm-profdata merge -o %t-1.profdata --binary-file=%t-1.exe %t-1.profraw
+// RUN: diff %t.normal.profdata %t-1.profdata
 
 // Strip above binary and run
 // RUN: llvm-strip %t-1.exe -o %t-2.exe
 // RUN: env LLVM_PROFILE_FILE=%t-2.profraw %run %t-2.exe
-// RUN: llvm-profdata merge -o %t-2.profdata --binary-file=%t-1.exe %t-2.profraw 
-// RUN: diff %t.normal.profdata %t-2.profdata 
+// RUN: llvm-profdata merge -o %t-2.profdata --binary-file=%t-1.exe %t-2.profraw
+// RUN: diff %t.normal.profdata %t-2.profdata
 
 // Online merging.
 // RUN: env LLVM_PROFILE_FILE=%t-3.profraw %run %t.normal
diff --git a/llvm/include/llvm/ProfileData/InstrProfCorrelator.h b/llvm/include/llvm/ProfileData/InstrProfCorrelator.h
index 661570eaee11..ba82702354c1 100644
--- a/llvm/include/llvm/ProfileData/InstrProfCorrelator.h
+++ b/llvm/include/llvm/ProfileData/InstrProfCorrelator.h
@@ -5,7 +5,7 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
-// This file defines InstrProfCorrelator used to generate PGO/coverage profiles 
+// This file defines InstrProfCorrelator used to generate PGO/coverage profiles
 // from raw profile data and debug info/binary file.
 //===----------------------------------------------------------------------===//
 
diff --git a/llvm/lib/ProfileData/InstrProfCorrelator.cpp b/llvm/lib/ProfileData/InstrProfCorrelator.cpp
index 168c2803145f..6796f2828d01 100644
--- a/llvm/lib/ProfileData/InstrProfCorrelator.cpp
+++ b/llvm/lib/ProfileData/InstrProfCorrelator.cpp
@@ -206,8 +206,8 @@ InstrProfCorrelatorImpl<IntPtrT>::get(
   if (Obj.isELF() || Obj.isCOFF())
     return std::make_unique<BinaryInstrProfCorrelator<IntPtrT>>(std::move(Ctx));
   return make_error<InstrProfError>(
-        instrprof_error::unable_to_correlate_profile,
-        "unsupported binary format (only ELF and COFF are supported)");
+      instrprof_error::unable_to_correlate_profile,
+      "unsupported binary format (only ELF and COFF are supported)");
 }
 
 template <class IntPtrT>

``````````

</details>


https://github.com/llvm/llvm-project/pull/69493


More information about the cfe-commits mailing list