[BOLT] Zero initialize pre-aggregated counters (#142698)
#140196 introduced UB by using uninitialized misprediction count for pre-aggregated traces. Fix by zero initializing both counters. Test Plan: updated entry-point-fallthru.s
This commit is contained in:
@@ -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()) {
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user