mirror of
https://github.com/RPCS3/llvm.git
synced 2026-01-31 01:25:19 +01:00
[utils] Add minimal support for MIR inputs to update_llc_test_checks.py
update_{llc,mir}_test_checks.py applicability is determined by the
output (assembly or MIR), not the input, which makes
update_llc_test_checks.py the right tool to generate tests that start at
MIR and stop at the final assembly.
This commit adds the minimal support for this path. Main limitation that
remains:
- MIR has to have LLVM IR section, and the CHECK lines will be inserted
into the LLVM IR functions that correspond to the MIR functions.
Running
../utils/update_llc_test_checks.py --llc-binary ./bin/llc
on a slightly modified ../test/CodeGen/X86/bad-tls-fold.mir
produces the following diff:
+# NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+# RUN: llc %s -o - | FileCheck %s
--- |
target triple = "x86_64-unknown-linux-gnu"
@@ -6,17 +7,31 @@
@i = external thread_local global i32
define i32 @or() {
+ ; CHECK-LABEL: or:
+ ; CHECK: # %bb.0: # %entry
+ ; CHECK-NEXT: movq {{.*}}(%rip), %rax
+ ; CHECK-NEXT: orq $7, %rax
+ ; CHECK-NEXT: movq i@{{.*}}(%rip), %rcx
+ ; CHECK-NEXT: orq %rax, %rcx
+ ; CHECK-NEXT: movl %fs:(%rcx), %eax
+ ; CHECK-NEXT: retq
entry:
ret i32 undef
}
-
define i32 @and() {
+ ; CHECK-LABEL: and:
+ ; CHECK: # %bb.0: # %entry
+ ; CHECK-NEXT: movq {{.*}}(%rip), %rax
+ ; CHECK-NEXT: orq $7, %rax
+ ; CHECK-NEXT: movq i@{{.*}}(%rip), %rcx
+ ; CHECK-NEXT: andq %rax, %rcx
+ ; CHECK-NEXT: movl %fs:(%rcx), %eax
+ ; CHECK-NEXT: retq
entry:
ret i32 undef
}
...
(not applied)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372277 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -19,7 +19,7 @@ import re
|
||||
|
||||
from UpdateTestChecks import asm, common
|
||||
|
||||
ADVERT = '; NOTE: Assertions have been autogenerated by '
|
||||
ADVERT = ' NOTE: Assertions have been autogenerated by '
|
||||
|
||||
|
||||
def main():
|
||||
@@ -44,7 +44,6 @@ def main():
|
||||
args = parser.parse_args()
|
||||
|
||||
script_name = os.path.basename(__file__)
|
||||
autogenerated_note = (ADVERT + 'utils/' + script_name)
|
||||
|
||||
test_paths = [test for pattern in args.tests for test in glob.glob(pattern)]
|
||||
for test in test_paths:
|
||||
@@ -118,6 +117,13 @@ def main():
|
||||
|
||||
llc_cmd_args = llc_cmd[len(llc_tool):].strip()
|
||||
llc_cmd_args = llc_cmd_args.replace('< %s', '').replace('%s', '').strip()
|
||||
if test.endswith('.mir'):
|
||||
llc_cmd_args += ' -x mir'
|
||||
comment_sym = '#'
|
||||
check_indent = ' '
|
||||
else:
|
||||
comment_sym = ';'
|
||||
check_indent = ''
|
||||
|
||||
check_prefixes = [item for m in common.CHECK_PREFIX_RE.finditer(filecheck_cmd)
|
||||
for item in m.group(1).split(',')]
|
||||
@@ -128,6 +134,8 @@ def main():
|
||||
# now, we just ignore all but the last.
|
||||
run_list.append((check_prefixes, llc_cmd_args, triple_in_cmd, march_in_cmd))
|
||||
|
||||
autogenerated_note = (comment_sym + ADVERT + 'utils/' + script_name)
|
||||
|
||||
func_dict = {}
|
||||
for p in run_list:
|
||||
prefixes = p[0]
|
||||
@@ -166,7 +174,7 @@ def main():
|
||||
continue
|
||||
|
||||
# Print out the various check lines here.
|
||||
asm.add_asm_checks(output_lines, ';', run_list, func_dict, func_name)
|
||||
asm.add_asm_checks(output_lines, check_indent + ';', run_list, func_dict, func_name)
|
||||
is_in_function_start = False
|
||||
|
||||
if is_in_function:
|
||||
@@ -180,7 +188,7 @@ def main():
|
||||
continue
|
||||
|
||||
# Discard any previous script advertising.
|
||||
if input_line.startswith(ADVERT):
|
||||
if input_line.startswith(comment_sym + ADVERT):
|
||||
continue
|
||||
|
||||
# If it's outside a function, it just gets copied to the output.
|
||||
|
||||
Reference in New Issue
Block a user