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
diff --git a/llvm/utils/update_llc_test_checks.py b/llvm/utils/update_llc_test_checks.py
index 9dd25d3..0936a44 100755
--- a/llvm/utils/update_llc_test_checks.py
+++ b/llvm/utils/update_llc_test_checks.py
@@ -81,6 +81,11 @@
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 @@
# 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