[PATCH] D149046: [BOLT][Wrapper] Fix off-by-one when parsing 'cmp' output
Job Noorman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 24 02:35:13 PDT 2023
jobnoorman created this revision.
jobnoorman added reviewers: rafauler, maksfb, yota9, Amir.
Herald added subscribers: asb, treapster, pmatos, ayermolo.
Herald added a project: All.
jobnoorman requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D149046
Files:
bolt/utils/llvm-bolt-wrapper.py
Index: bolt/utils/llvm-bolt-wrapper.py
===================================================================
--- bolt/utils/llvm-bolt-wrapper.py
+++ bolt/utils/llvm-bolt-wrapper.py
@@ -206,7 +206,8 @@
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):
'''
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149046.516328.patch
Type: text/x-patch
Size: 536 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230424/6052ae41/attachment.bin>
More information about the llvm-commits
mailing list