[BOLT] Fix LIT tests on Windows VS2019

Fix newline issue in link_fdata.py, as well as how to call the tool.

Reviewed By: Amir

Differential Revision: https://reviews.llvm.org/D126437
This commit is contained in:
Rafael Auler 2022-05-31 11:45:15 -07:00 committed by Rafael Auler
parent 4b763c4ef8
commit b8a6345554
9 changed files with 9 additions and 12 deletions

View File

@ -3,7 +3,7 @@
RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown \
RUN: %S/Inputs/ft_to_noop.s -o %t.o
RUN: link_fdata %S/Inputs/ft_to_noop.s %t.o %t.fdata
RUN: link_fdata %S/Inputs/ft_to_noop.s %t.o %t.fdata --nmtool llvm-nm
RUN: llvm-strip --strip-unneeded %t.o
RUN: %clang %cflags %t.o -o %t.exe -Wl,-q
RUN: llvm-bolt %t.exe -o %t -data %t.fdata \

View File

@ -3,7 +3,7 @@
RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown \
RUN: %S/Inputs/jump_table_footprint_reduction.s -o %t.o
RUN: link_fdata %S/Inputs/jump_table_footprint_reduction.s %t.o %t.fdata
RUN: link_fdata %S/Inputs/jump_table_footprint_reduction.s %t.o %t.fdata --nmtool llvm-nm
RUN: llvm-strip --strip-unneeded %t.o
RUN: %clang %cflags -no-pie %t.o -o %t.exe -Wl,-q
RUN: llvm-bolt %t.exe -data %t.fdata -o /dev/null \

View File

@ -1,6 +1,6 @@
RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown \
RUN: %p/Inputs/jump_table_icp.s -o %t.o
RUN: link_fdata %p/Inputs/jump_table_icp.s %t.o %t.fdata
RUN: link_fdata %p/Inputs/jump_table_icp.s %t.o %t.fdata --nmtool llvm-nm
RUN: llvm-strip --strip-unneeded %t.o
RUN: %clang %cflags -no-pie %t.o -o %t.exe -Wl,-q

View File

@ -2,7 +2,7 @@
RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown \
RUN: %p/Inputs/loop_nest.s -o %t.o
RUN: link_fdata %p/Inputs/loop_nest.s %t.o %t.fdata
RUN: link_fdata %p/Inputs/loop_nest.s %t.o %t.fdata --nmtool llvm-nm
RUN: llvm-strip --strip-unneeded %t.o
RUN: %clang %cflags -no-pie %t.o -o %t.exe -Wl,-q

View File

@ -1,11 +1,8 @@
# Check merge-fdata tool correctly processes fdata files with header strings
# such as the ones produced by BAT mode (boltedcollection)
RUN: merge-fdata %S/Inputs/bat_profile_1.fdata \
RUN: %S/Inputs/bat_profile_2.fdata 2> %t.error \
RUN: %S/Inputs/bat_profile_2.fdata \
RUN: | FileCheck %s --check-prefix=CHECK-FDATA
RUN: cat %t.error |& FileCheck %s --check-prefix=CHECK-ERROR
CHECK-ERROR-NOT: Malformed
CHECK-FDATA: 1 main 451 1 SolveCubic 0 0 302

View File

@ -2,7 +2,7 @@
# entry point even if there is a hot edge from a block to entry point
RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %S/Inputs/entry.s -o %t.o
RUN: link_fdata %S/Inputs/entry.s %t.o %t.fdata
RUN: link_fdata %S/Inputs/entry.s %t.o %t.fdata --nmtool llvm-nm
RUN: llvm-strip --strip-unneeded %t.o
RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -nostdlib
RUN: llvm-bolt %t.exe -data %t.fdata -o /dev/null -reorder-blocks=normal \

View File

@ -2,7 +2,7 @@
# the BB reordering ignores dead BBs.
RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %S/Inputs/entry.s -o %t.o
RUN: link_fdata %S/Inputs/entry.s %t.o %t.fdata
RUN: link_fdata %S/Inputs/entry.s %t.o %t.fdata --nmtool llvm-nm
RUN: llvm-strip --strip-unneeded %t.o
RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -nostdlib
RUN: llvm-bolt %t.exe -data %t.fdata -o %t -funcs=_start \

View File

@ -98,7 +98,7 @@ def replace_symbol(matchobj):
assert symname in symbols, f"ERROR: symbol {symname} is not defined in binary"
return symbols[symname]
with open(args.output, 'w') as f:
with open(args.output, 'w', newline='\n') as f:
for etype, expr in exprs:
if etype == 'FDATA':
issym1, anchor1, offsym1, issym2, anchor2, offsym2, execnt, mispred = expr

View File

@ -88,7 +88,7 @@ tools = [
ToolSubst('llvm-objcopy', unresolved='fatal'),
ToolSubst('llvm-strip', unresolved='fatal'),
ToolSubst('llvm-readelf', unresolved='fatal'),
ToolSubst('link_fdata', command=link_fdata_cmd, unresolved='fatal'),
ToolSubst('link_fdata', command=sys.executable, unresolved='fatal', extra_args=[link_fdata_cmd]),
ToolSubst('merge-fdata', unresolved='fatal'),
ToolSubst('llvm-readobj', unresolved='fatal'),
]