Skip to content

[utils][UpdateTestChecks] Warn about possible target triple mismatch #149645

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tomershafir
Copy link
Contributor

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.

Copy link

github-actions bot commented Jul 19, 2025

✅ With the latest revision this PR passed the Python code formatter.

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.
@tomershafir tomershafir force-pushed the utils-update-llc-checks-warn-target-triple-mismatch branch from 67a579d to 640e3b0 Compare July 19, 2025 08:52
@tomershafir tomershafir marked this pull request as ready for review July 19, 2025 14:41
@llvmbot
Copy link
Member

llvmbot commented Jul 19, 2025

@llvm/pr-subscribers-testing-tools

Author: Tomer Shafir (tomershafir)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/149645.diff

2 Files Affected:

  • (modified) llvm/utils/UpdateTestChecks/common.py (+3)
  • (modified) llvm/utils/update_llc_test_checks.py (+6-1)
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()

@tomershafir tomershafir requested review from MaskRay, MatzeB and fhahn July 23, 2025 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants