summaryrefslogtreecommitdiff
path: root/bolt
diff options
context:
space:
mode:
authorJob Noorman <jnoorman@igalia.com>2023-04-24 20:54:23 +0200
committerJob Noorman <jnoorman@igalia.com>2023-04-24 20:54:56 +0200
commit8421c7ad304faee9056f43dc771f0ff76c14afec (patch)
treeab0deddbfe52d3180352b147abcb9eccd9af67bc /bolt
parent09115580056fc57d5cdaa1de20631a838a4ea1c4 (diff)
downloadllvm-8421c7ad304faee9056f43dc771f0ff76c14afec.tar.gz
[BOLT][Wrapper] Fix off-by-one when parsing 'cmp' output
The byte offsets in the output of 'cmp' start from 1, not from 0 as the current parser assumes. This caused mismatched bytes to sometimes be attributed to the wrong section. Reviewed By: rafauler Differential Revision: https://reviews.llvm.org/D149046
Diffstat (limited to 'bolt')
-rwxr-xr-xbolt/utils/llvm-bolt-wrapper.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/bolt/utils/llvm-bolt-wrapper.py b/bolt/utils/llvm-bolt-wrapper.py
index 652cc6074462..a6d863ce7caa 100755
--- a/bolt/utils/llvm-bolt-wrapper.py
+++ b/bolt/utils/llvm-bolt-wrapper.py
@@ -206,7 +206,8 @@ def parse_cmp_offset(cmp_out):
Extracts byte number from cmp output:
file1 file2 differ: byte X, line Y
'''
- return int(re.search(r'byte (\d+),', cmp_out).groups()[0])
+ # NOTE: cmp counts bytes starting from 1!
+ return int(re.search(r'byte (\d+),', cmp_out).groups()[0]) - 1
def report_real_time(binary, main_err, cmp_err, cfg):
'''