Skip to content

Commit 19d41ca

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, 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 19d41ca

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

llvm/utils/UpdateTestChecks/common.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,9 +881,11 @@ 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+
processed_func_count = 0
884885
for m in function_re.finditer(raw_tool_output):
885886
if not m:
886887
continue
888+
processed_func_count += 1
887889
func = m.group("func")
888890
body = m.group("body")
889891
# func_name_separator is the string that is placed right after function name at the
@@ -1000,6 +1002,7 @@ def process_run_line(self, function_re, scrubber, raw_tool_output, prefixes):
10001002
# preprocesser directives to exclude individual functions from some
10011003
# RUN lines.
10021004
self._func_dict[prefix][func] = None
1005+
return processed_func_count
10031006

10041007
def processed_prefixes(self, prefixes):
10051008
"""

llvm/utils/update_llc_test_checks.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,12 @@ 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(
146+
function_re, scrubber, raw_tool_output, prefixes
147+
):
148+
common.warn(
149+
"Couldn't match any function. Possibly the wrong target triple has been provided"
150+
)
146151
builder.processed_prefixes(prefixes)
147152

148153
func_dict = builder.finish_and_get_func_dict()

0 commit comments

Comments
 (0)