From: Job Noorman Date: Mon, 24 Apr 2023 18:54:23 +0000 (+0200) Subject: [BOLT][Wrapper] Fix off-by-one when parsing 'cmp' output X-Git-Tag: upstream/17.0.6~10587 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8421c7ad304faee9056f43dc771f0ff76c14afec;p=platform%2Fupstream%2Fllvm.git [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 --- diff --git a/bolt/utils/llvm-bolt-wrapper.py b/bolt/utils/llvm-bolt-wrapper.py index 652cc60..a6d863c 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): '''