[llvm] [BOLT][NFC] Align fdata pattern ordering in link_fdata.py (PR #142102)
Paschalis Mpeis via llvm-commits
llvm-commits at lists.llvm.org
Fri May 30 01:03:05 PDT 2025
https://github.com/paschalis-mpeis created https://github.com/llvm/llvm-project/pull/142102
The mispred and execnt values were originally recorded in reverse order and then consumed in the opposite order to compensate.
This patch records and uses them in the same order (FDATA) for clarity. That order is:
<is symbol?> <closest ELF symbol or DSO name> <relative FROM address> <is symbol?> <closest ELF symbol or DSO name> <relative TO address> <number of mispredictions> <number of branches>
>From c53774e1e7e9d5bdcf4c912687ccc4d1f8478e50 Mon Sep 17 00:00:00 2001
From: Paschalis Mpeis <Paschalis.Mpeis at arm.com>
Date: Fri, 30 May 2025 08:36:50 +0100
Subject: [PATCH] [BOLT][NFC] Align fdata pattern ordering in link_fdata.py
The mispred and execnt values were originally recorded in reverse order and
then consumed in the opposite order to compensate.
This patch records and uses them in the same order (FDATA) for clarity.
That order is:
<is symbol?> <closest ELF symbol or DSO name> <relative FROM address>
<is symbol?> <closest ELF symbol or DSO name> <relative TO address>
<number of mispredictions> <number of branches>
---
bolt/test/link_fdata.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/bolt/test/link_fdata.py b/bolt/test/link_fdata.py
index bcf9a777922d5..b6358fae1b8d0 100755
--- a/bolt/test/link_fdata.py
+++ b/bolt/test/link_fdata.py
@@ -33,7 +33,7 @@
# <is symbol?> <closest elf symbol or DSO name> <relative FROM address>
# <is symbol?> <closest elf symbol or DSO name> <relative TO address>
# <number of mispredictions> <number of branches>
-fdata_pat = re.compile(r"([01].*) (?P<exec>\d+) (?P<mispred>\d+)")
+fdata_pat = re.compile(r"([01].*) (?P<mispred>\d+) (?P<exec>\d+)")
# Pre-aggregated profile:
# {T|B|F|f} [<start_id>:]<start_offset> [<end_id>:]<end_offset> [<ft_end>]
@@ -61,7 +61,7 @@
preagg_match = preagg_pat.match(profile_line)
nolbr_match = nolbr_pat.match(profile_line)
if fdata_match:
- src_dst, execnt, mispred = fdata_match.groups()
+ src_dst, mispred, execnt = fdata_match.groups()
# Split by whitespaces not preceded by a backslash (negative lookbehind)
chunks = re.split(r"(?<!\\) +", src_dst)
# Check if the number of records separated by non-escaped whitespace
@@ -69,7 +69,7 @@
assert (
len(chunks) == 6
), f"ERROR: wrong format/whitespaces must be escaped:\n{line}"
- exprs.append(("FDATA", (*chunks, execnt, mispred)))
+ exprs.append(("FDATA", (*chunks, mispred, execnt)))
elif nolbr_match:
loc, count = nolbr_match.groups()
# Split by whitespaces not preceded by a backslash (negative lookbehind)
More information about the llvm-commits
mailing list