[llvm-branch-commits] [BOLT] Zero initialize pre-aggregated counters (PR #142698)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Jun 3 16:56:10 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-bolt
Author: Amir Ayupov (aaupov)
<details>
<summary>Changes</summary>
pre-aggregated traces. Fix by zero initializing both counters.
Test Plan: updated entry-point-fallthru.s
---
Full diff: https://github.com/llvm/llvm-project/pull/142698.diff
2 Files Affected:
- (modified) bolt/lib/Profile/DataAggregator.cpp (+1-1)
- (modified) bolt/test/X86/entry-point-fallthru.s (+4)
``````````diff
diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp
index f51d4ae2799e2..134c9324603b2 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -1220,7 +1220,7 @@ std::error_code DataAggregator::parseAggregatedLBREntry() {
// Storage for parsed fields.
StringRef EventName;
std::optional<Location> Addr[3];
- int64_t Counters[2];
+ int64_t Counters[2] = {0};
while (Type == INVALID || Type == EVENT_NAME) {
while (checkAndConsumeFS()) {
diff --git a/bolt/test/X86/entry-point-fallthru.s b/bolt/test/X86/entry-point-fallthru.s
index edf14247b0c43..850247b97d27e 100644
--- a/bolt/test/X86/entry-point-fallthru.s
+++ b/bolt/test/X86/entry-point-fallthru.s
@@ -6,6 +6,10 @@
# RUN: link_fdata %s %t %t.preagg PREAGG
# RUN: perf2bolt %t -p %t.preagg --pa -o %t.fdata | FileCheck %s
# CHECK: traces mismatching disassembled function contents: 0
+# RUN: FileCheck %s --check-prefix=CHECK-FDATA --input-file %t.fdata
+# CHECK-FDATA: 1 main 0 1 main 6 0 1
+# CHECK-FDATA-NEXT: 1 main e 1 main 11 0 1
+# CHECK-FDATA-NEXT: 1 main 11 1 main 0 0 1
.globl main
main:
``````````
</details>
https://github.com/llvm/llvm-project/pull/142698
More information about the llvm-branch-commits
mailing list