[utils][UpdateTestChecks] Warn about possible target triple mismatch (#149645)
Aims to improve error reporting by printing a warning if the target function regex that has been selected finds no matches. For example, a `-mtriple=arm64-apple-darwin` runline, would map to the `arm64` prefix by `update_llc_test_checks.py` and wouldn't match Apple's function layout, generating some not understandable garbage checks. The implementation changes `common.process_run_line` to return an abstract indicator of number of functions processed, without breaking the drivers. Then `update_llc_test_checks.py` prints a driver specific error message.
This commit is contained in:
parent
296e057d0b
commit
d64e6b5e27
@ -0,0 +1,7 @@
|
||||
; RUN: llc < %s -mtriple=arm64-apple-darwin | FileCheck %s
|
||||
|
||||
define i64 @foo(i64 %a) {
|
||||
entry:
|
||||
%b = add i64 %a, 1
|
||||
ret i64 %b
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
# REQUIRES: aarch64-registered-target
|
||||
## Check that arm64-apple-darwin target triple is wrongly captured as arm64 (non-Apple)
|
||||
|
||||
# RUN: cp -f %S/Inputs/target-triple-mismatch.ll %t.ll
|
||||
# RUN: %update_llc_test_checks %t.ll 2>&1 | FileCheck %s --check-prefix=LOG
|
||||
# RUN: FileCheck --input-file=%t.ll %s --check-prefix=AUTOGEN
|
||||
|
||||
# LOG: WARNING: Couldn't match any function. Possibly the wrong target triple has been provided
|
||||
|
||||
# AUTOGEN: ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
|
||||
# AUTOGEN-NEXT: ; CHECK: {{.*}}
|
@ -878,12 +878,17 @@ class FunctionTestBuilder:
|
||||
return False
|
||||
|
||||
def process_run_line(self, function_re, scrubber, raw_tool_output, prefixes):
|
||||
"""
|
||||
Returns the number of functions processed from the output by the regex.
|
||||
"""
|
||||
build_global_values_dictionary(
|
||||
self._global_var_dict, raw_tool_output, prefixes, self._ginfo
|
||||
)
|
||||
processed_func_count = 0
|
||||
for m in function_re.finditer(raw_tool_output):
|
||||
if not m:
|
||||
continue
|
||||
processed_func_count += 1
|
||||
func = m.group("func")
|
||||
body = m.group("body")
|
||||
# func_name_separator is the string that is placed right after function name at the
|
||||
@ -1000,6 +1005,7 @@ class FunctionTestBuilder:
|
||||
# preprocesser directives to exclude individual functions from some
|
||||
# RUN lines.
|
||||
self._func_dict[prefix][func] = None
|
||||
return processed_func_count
|
||||
|
||||
def processed_prefixes(self, prefixes):
|
||||
"""
|
||||
|
@ -142,7 +142,12 @@ def update_test(ti: common.TestInfo):
|
||||
triple = common.get_triple_from_march(march_in_cmd)
|
||||
|
||||
scrubber, function_re = output_type.get_run_handler(triple)
|
||||
builder.process_run_line(function_re, scrubber, raw_tool_output, prefixes)
|
||||
if 0 == builder.process_run_line(
|
||||
function_re, scrubber, raw_tool_output, prefixes
|
||||
):
|
||||
common.warn(
|
||||
"Couldn't match any function. Possibly the wrong target triple has been provided"
|
||||
)
|
||||
builder.processed_prefixes(prefixes)
|
||||
|
||||
func_dict = builder.finish_and_get_func_dict()
|
||||
|
Loading…
x
Reference in New Issue
Block a user