UpdateTestChecks: fix AMDGPU handling

Summary:
Was looking into supporting `(srl (shl x, c1), c2)` with c1 != c2 in dagcombiner,
this test changes, but makes `update_llc_test_checks.py` unhappy.

**Many** AMDGPU tests specify `-march`, not `-mtriple`, which results in `update_llc_test_checks.py`
defaulting to x86 asm function detection heuristics, which don't work here.
I propose to fix this by adding an infrastructure to map from `-march` to `-mtriple`,
in the UpdateTestChecks tooling.

Reviewers: RKSimon, MaskRay, arsenm

Reviewed By: arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D62099

llvm-svn: 361101
This commit is contained in:
Roman Lebedev 2019-05-18 13:00:03 +00:00
parent 822b9c971b
commit 98092f37d0
3 changed files with 1368 additions and 233 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,4 @@
from __future__ import print_function
import re
import sys
@ -199,6 +200,15 @@ def scrub_asm_systemz(asm, args):
asm = common.SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
return asm
def get_triple_from_march(march):
triples = {
'amdgcn': 'amdgcn',
}
for prefix, triple in triples.items():
if march.startswith(prefix):
return triple
print("Cannot find a triple. Assume 'x86'", file=sys.stderr)
return 'x86'
def build_function_body_dictionary_for_triple(args, raw_tool_output, triple, prefixes, func_dict):
target_handlers = {

View File

@ -81,6 +81,11 @@ def main():
if m:
triple_in_cmd = m.groups()[0]
march_in_cmd = None
m = common.MARCH_ARG_RE.search(llc_cmd)
if m:
march_in_cmd = m.groups()[0]
filecheck_cmd = ''
if len(commands) > 1:
filecheck_cmd = commands[1]
@ -102,24 +107,25 @@ def main():
# FIXME: We should use multiple check prefixes to common check lines. For
# now, we just ignore all but the last.
run_list.append((check_prefixes, llc_cmd_args, triple_in_cmd))
run_list.append((check_prefixes, llc_cmd_args, triple_in_cmd, march_in_cmd))
func_dict = {}
for p in run_list:
prefixes = p[0]
for prefix in prefixes:
func_dict.update({prefix: dict()})
for prefixes, llc_args, triple_in_cmd in run_list:
for prefixes, llc_args, triple_in_cmd, march_in_cmd in run_list:
if args.verbose:
print('Extracted LLC cmd: llc ' + llc_args, file=sys.stderr)
print('Extracted FileCheck prefixes: ' + str(prefixes), file=sys.stderr)
raw_tool_output = common.invoke_tool(args.llc_binary, llc_args, test)
if not (triple_in_cmd or triple_in_ir):
print("Cannot find a triple. Assume 'x86'", file=sys.stderr)
triple = triple_in_cmd or triple_in_ir
if not triple:
triple = asm.get_triple_from_march(march_in_cmd)
asm.build_function_body_dictionary_for_triple(args, raw_tool_output,
triple_in_cmd or triple_in_ir or 'x86', prefixes, func_dict)
triple, prefixes, func_dict)
is_in_function = False
is_in_function_start = False