[llvm] [BOLT][NFC] Align fdata pattern ordering in link_fdata.py (PR #142102)
via llvm-commits
llvm-commits at lists.llvm.org
Fri May 30 01:03:38 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-bolt
Author: Paschalis Mpeis (paschalis-mpeis)
<details>
<summary>Changes</summary>
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>
---
Full diff: https://github.com/llvm/llvm-project/pull/142102.diff
1 Files Affected:
- (modified) bolt/test/link_fdata.py (+3-3)
``````````diff
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)
``````````
</details>
https://github.com/llvm/llvm-project/pull/142102
More information about the llvm-commits
mailing list