[PATCH] D154118: [BOLT][NFC] Simplify parseLBRSample
Amir Ayupov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 29 10:41:50 PDT 2023
Amir created this revision.
Amir added a reviewer: bolt.
Herald added a reviewer: rafauler.
Herald added subscribers: treapster, ayermolo.
Herald added a reviewer: maksfb.
Herald added a project: All.
Amir requested review of this revision.
Herald added subscribers: llvm-commits, yota9.
Herald added a project: LLVM.
Make dropping LBR entries a bit more explicit in SKL LBR workaround.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D154118
Files:
bolt/lib/Profile/DataAggregator.cpp
Index: bolt/lib/Profile/DataAggregator.cpp
===================================================================
--- bolt/lib/Profile/DataAggregator.cpp
+++ bolt/lib/Profile/DataAggregator.cpp
@@ -1368,17 +1368,14 @@
// LBRs are stored in reverse execution order. NextPC refers to the next
// recorded executed PC.
uint64_t NextPC = opts::UseEventPC ? Sample.PC : 0;
- uint32_t NumEntry = 0;
- for (const LBREntry &LBR : Sample.LBR) {
- ++NumEntry;
- // Hardware bug workaround: Intel Skylake (which has 32 LBR entries)
- // sometimes record entry 32 as an exact copy of entry 31. This will cause
- // us to likely record an invalid trace and generate a stale function for
- // BAT mode (non BAT disassembles the function and is able to ignore this
- // trace at aggregation time). Drop first 2 entries (last two, in
- // chronological order)
- if (NeedsSkylakeFix && NumEntry <= 2)
- continue;
+ // Hardware bug workaround: Intel Skylake (which has 32 LBR entries)
+ // sometimes record entry 32 as an exact copy of entry 31. This will cause
+ // us to likely record an invalid trace and generate a stale function for
+ // BAT mode (non BAT disassembles the function and is able to ignore this
+ // trace at aggregation time). Drop first 2 entries (last two, in
+ // chronological order)
+ for (const LBREntry &LBR :
+ llvm::drop_begin(Sample.LBR, NeedsSkylakeFix ? 2 : 0)) {
if (NextPC) {
// Record fall-through trace.
const uint64_t TraceFrom = LBR.To;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154118.535894.patch
Type: text/x-patch
Size: 1526 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230629/66559ca7/attachment.bin>
More information about the llvm-commits
mailing list