summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaschalis Mpeis <Paschalis.Mpeis@arm.com>2024-10-15 18:05:41 +0100
committerPaschalis Mpeis <Paschalis.Mpeis@arm.com>2024-10-21 12:26:22 +0100
commit3d5a9248256f0c4bc8aef3bcddf8caf29aaee608 (patch)
tree4ee5f724e908a9f9135087d6dc6cbfaa9b3d448c
parent55a40d3e50733de59a60cfe80f9a69ff6b8486cd (diff)
[BOLT] link_fdata support for hardcoded offsets in no-LBRusers/paschalis-mpeis/bolt-link-fdata-nolbr
Allow using hardcoded offsets to blocks, eg: ``` // RUN: link_fdata --no-lbr ... // FDATA: 1 foo 0 10 ``` For LBR mode this was already supported. See for example: - tail-duplication-complex.s
-rw-r--r--bolt/test/AArch64/fdata-nolbr.s7
-rwxr-xr-xbolt/test/link_fdata.py2
2 files changed, 5 insertions, 4 deletions
diff --git a/bolt/test/AArch64/fdata-nolbr.s b/bolt/test/AArch64/fdata-nolbr.s
index 5bb655f0f94c..5d7c0a401498 100644
--- a/bolt/test/AArch64/fdata-nolbr.s
+++ b/bolt/test/AArch64/fdata-nolbr.s
@@ -5,7 +5,8 @@
# RUN: %clang %cflags -o %t %s
# RUN: %clang %s %cflags -Wl,-q -o %t
-# RUN: not link_fdata --no-lbr %s %t %t.fdata 2>&1 | FileCheck %s
+# RUN: link_fdata --no-lbr %s %t %t.fdata
+# RUN: cat %t.fdata | FileCheck %s
.text
.globl foo
@@ -14,5 +15,5 @@ foo:
# FDATA: 1 foo 0 10
ret
-# Currently does not work on non-lbr mode.
-# CHECK: AssertionError: ERROR: wrong format/whitespaces must be escaped
+# CHECK: no_lbr
+# CHECK-NEXT: 1 foo 0 10
diff --git a/bolt/test/link_fdata.py b/bolt/test/link_fdata.py
index 3837e394ccc8..613d58248bb0 100755
--- a/bolt/test/link_fdata.py
+++ b/bolt/test/link_fdata.py
@@ -58,7 +58,7 @@ with open(args.input, "r") as f:
fdata_match = fdata_pat.match(profile_line)
preagg_match = preagg_pat.match(profile_line)
nolbr_match = nolbr_pat.match(profile_line)
- if fdata_match:
+ if fdata_match and not (nolbr_match and args.no_lbr):
src_dst, execnt, mispred = fdata_match.groups()
# Split by whitespaces not preceded by a backslash (negative lookbehind)
chunks = re.split(r"(?<!\\) +", src_dst)