Skip to content

Commit f2582c9

Browse files
[BOLT][NFC] Align fdata pattern ordering in link_fdata.py (#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> ```
1 parent 3297340 commit f2582c9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

bolt/test/link_fdata.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
# <is symbol?> <closest elf symbol or DSO name> <relative FROM address>
3434
# <is symbol?> <closest elf symbol or DSO name> <relative TO address>
3535
# <number of mispredictions> <number of branches>
36-
fdata_pat = re.compile(r"([01].*) (?P<exec>\d+) (?P<mispred>\d+)")
36+
fdata_pat = re.compile(r"([01].*) (?P<mispred>\d+) (?P<exec>\d+)")
3737

3838
# Pre-aggregated profile:
3939
# {T|B|F|f} [<start_id>:]<start_offset> [<end_id>:]<end_offset> [<ft_end>]
@@ -61,15 +61,15 @@
6161
preagg_match = preagg_pat.match(profile_line)
6262
nolbr_match = nolbr_pat.match(profile_line)
6363
if fdata_match:
64-
src_dst, execnt, mispred = fdata_match.groups()
64+
src_dst, mispred, execnt = fdata_match.groups()
6565
# Split by whitespaces not preceded by a backslash (negative lookbehind)
6666
chunks = re.split(r"(?<!\\) +", src_dst)
6767
# Check if the number of records separated by non-escaped whitespace
6868
# exactly matches the format.
6969
assert (
7070
len(chunks) == 6
7171
), f"ERROR: wrong format/whitespaces must be escaped:\n{line}"
72-
exprs.append(("FDATA", (*chunks, execnt, mispred)))
72+
exprs.append(("FDATA", (*chunks, mispred, execnt)))
7373
elif nolbr_match:
7474
loc, count = nolbr_match.groups()
7575
# Split by whitespaces not preceded by a backslash (negative lookbehind)

0 commit comments

Comments
 (0)