[llvm] [llvm-profgen] Handle perf mmaps with page sizes larger than 4 KiB (PR #217887)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 25 12:24:45 PDT 2026
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 origin/main HEAD --extensions h,cpp -- llvm/tools/llvm-profgen/PerfReader.cpp llvm/tools/llvm-profgen/ProfiledBinary.cpp llvm/tools/llvm-profgen/ProfiledBinary.h --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</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 f48e12e61..6aad37241 100644
--- a/llvm/tools/llvm-profgen/PerfReader.cpp
+++ b/llvm/tools/llvm-profgen/PerfReader.cpp
@@ -602,9 +602,9 @@ void PerfScriptReader::updateBinaryAddress(const MMapEvent &Event) {
};
const bool MMapContainsTextSegment =
MMapContainsFileOffset(Binary->getTextSegmentOffset());
- const uint64_t RuntimeBaseAddress =
- IsKernel || Binary->isCOFF() ? Event.Address
- : Event.Address - Event.Offset;
+ const uint64_t RuntimeBaseAddress = IsKernel || Binary->isCOFF()
+ ? Event.Address
+ : Event.Address - Event.Offset;
// Drop the event if its image has the same base address.
if ((IsKernel || MMapContainsTextSegment) &&
@@ -629,8 +629,7 @@ void PerfScriptReader::updateBinaryAddress(const MMapEvent &Event) {
// The event is for loading a separate executable segment.
auto I = std::distance(Offsets.begin(), It);
const auto &PreferredAddrs = Binary->getPreferredTextSegmentAddresses();
- uint64_t RuntimeSegmentAddress =
- Event.Address + (*It - Event.Offset);
+ uint64_t RuntimeSegmentAddress = Event.Address + (*It - Event.Offset);
if (PreferredAddrs[I] !=
Binary->canonicalizeVirtualAddress(RuntimeSegmentAddress))
exitWithError("Executable segments not loaded consecutively");
``````````
</details>
https://github.com/llvm/llvm-project/pull/217887
More information about the llvm-commits
mailing list