[llvm] [llvm-profgen] Support creating profiles of arbitrary events (PR #99026)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 16 05:50:03 PDT 2024
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 e6ec7c8f74d1be778f4ddf794d0e2fb63b0dc3be 651db5ea0e95836f2b923252b6f0788bb1055ee9 --extensions cpp -- llvm/tools/llvm-profgen/PerfReader.cpp llvm/tools/llvm-profgen/ProfileGenerator.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/tools/llvm-profgen/PerfReader.cpp b/llvm/tools/llvm-profgen/PerfReader.cpp
index 3bf36b920b..b4e4911fb8 100644
--- a/llvm/tools/llvm-profgen/PerfReader.cpp
+++ b/llvm/tools/llvm-profgen/PerfReader.cpp
@@ -1297,11 +1297,11 @@ void PerfScriptReader::warnInvalidRange() {
// basic blocks/edges. In this mode, don't warn if sampled IPs aren't
// branches.
if (!LeadingIPOnly)
- if (!Binary->addressIsCode(StartAddress) ||
- !Binary->addressIsTransfer(EndAddress)) {
- InstNotBoundary += I.second;
- WarnInvalidRange(StartAddress, EndAddress, EndNotBoundaryMsg);
- }
+ if (!Binary->addressIsCode(StartAddress) ||
+ !Binary->addressIsTransfer(EndAddress)) {
+ InstNotBoundary += I.second;
+ WarnInvalidRange(StartAddress, EndAddress, EndNotBoundaryMsg);
+ }
auto *FRange = Binary->findFuncRange(StartAddress);
if (!FRange) {
diff --git a/llvm/tools/llvm-profgen/ProfileGenerator.cpp b/llvm/tools/llvm-profgen/ProfileGenerator.cpp
index e5a1383e7e..3a48d98f23 100644
--- a/llvm/tools/llvm-profgen/ProfileGenerator.cpp
+++ b/llvm/tools/llvm-profgen/ProfileGenerator.cpp
@@ -394,20 +394,20 @@ void ProfileGeneratorBase::updateBodySamplesforFunctionProfile(
// When computing an IP-based profile we take the SUM of counts at the
// location instead of applying duplication factors.
FunctionProfile.addBodySamples(LeafLoc.Location.LineOffset, Discriminator,
- Count);
+ Count);
} else {
// Otherwise, use duplication factor to compensate for loop
// unroll/vectorization. Note that this is only needed when we're taking
// MAX of the counts at the location instead of SUM.
Count *= getDuplicationFactor(LeafLoc.Location.Discriminator);
- ErrorOr<uint64_t> R =
- FunctionProfile.findSamplesAt(LeafLoc.Location.LineOffset, Discriminator);
+ ErrorOr<uint64_t> R = FunctionProfile.findSamplesAt(
+ LeafLoc.Location.LineOffset, Discriminator);
uint64_t PreviousCount = R ? R.get() : 0;
if (PreviousCount <= Count) {
FunctionProfile.addBodySamples(LeafLoc.Location.LineOffset, Discriminator,
- Count - PreviousCount);
+ Count - PreviousCount);
}
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/99026
More information about the llvm-commits
mailing list