Skip to content

Commit 67a579d

Browse files
committed
[utils][UpdateTestChecks] Warn about possible target triple mismatch
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, which is not a real triple looking forward (as it doesn't encode an actual OS), 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.
1 parent f223411 commit 67a579d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

llvm/utils/UpdateTestChecks/common.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,9 +881,12 @@ def process_run_line(self, function_re, scrubber, raw_tool_output, prefixes):
881881
build_global_values_dictionary(
882882
self._global_var_dict, raw_tool_output, prefixes, self._ginfo
883883
)
884+
885+
processed_func_count = 0
884886
for m in function_re.finditer(raw_tool_output):
885887
if not m:
886888
continue
889+
processed_func_count += 1
887890
func = m.group("func")
888891
body = m.group("body")
889892
# func_name_separator is the string that is placed right after function name at the
@@ -1000,6 +1003,7 @@ def process_run_line(self, function_re, scrubber, raw_tool_output, prefixes):
10001003
# preprocesser directives to exclude individual functions from some
10011004
# RUN lines.
10021005
self._func_dict[prefix][func] = None
1006+
return processed_func_count
10031007

10041008
def processed_prefixes(self, prefixes):
10051009
"""

llvm/utils/update_llc_test_checks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ def update_test(ti: common.TestInfo):
142142
triple = common.get_triple_from_march(march_in_cmd)
143143

144144
scrubber, function_re = output_type.get_run_handler(triple)
145-
builder.process_run_line(function_re, scrubber, raw_tool_output, prefixes)
145+
if not builder.process_run_line(function_re, scrubber, raw_tool_output, prefixes):
146+
common.warn("Couldn't match any function. Possibly the wrong target triple has been provided")
146147
builder.processed_prefixes(prefixes)
147148

148149
func_dict = builder.finish_and_get_func_dict()

0 commit comments

Comments
 (0)