[llvm] [utils][UpdateTestChecks] Warn about possible target triple mismatch (PR #149645)
Tomer Shafir via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 19 01:52:58 PDT 2025
https://github.com/tomershafir updated https://github.com/llvm/llvm-project/pull/149645
>From 640e3b0de308031146b8dbaf33b04f7dbf1d7a53 Mon Sep 17 00:00:00 2001
From: tomershafir <tomer.shafir8 at gmail.com>
Date: Sat, 19 Jul 2025 11:26:48 +0300
Subject: [PATCH] [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.
---
llvm/utils/UpdateTestChecks/common.py | 3 +++
llvm/utils/update_llc_test_checks.py | 7 ++++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py
index 178c623e33e0e..74311770c6b35 100644
--- a/llvm/utils/UpdateTestChecks/common.py
+++ b/llvm/utils/UpdateTestChecks/common.py
@@ -881,9 +881,11 @@ def process_run_line(self, function_re, scrubber, raw_tool_output, prefixes):
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 +1002,7 @@ def process_run_line(self, function_re, scrubber, raw_tool_output, prefixes):
# 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):
"""
diff --git a/llvm/utils/update_llc_test_checks.py b/llvm/utils/update_llc_test_checks.py
index 07216d7dbfbb2..e5aa555e1e1ee 100755
--- a/llvm/utils/update_llc_test_checks.py
+++ b/llvm/utils/update_llc_test_checks.py
@@ -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 not 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()
More information about the llvm-commits
mailing list