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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions llvm/utils/UpdateTestChecks/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
"""
Expand Down
7 changes: 6 additions & 1 deletion llvm/utils/update_llc_test_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to detect the target triple issue directly? In get_run_handler, we know all registered triples I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is the inherent issue this warning tries to warn about. get_run_handler can match a prefix, which can be wrong. For example -mtriple=arm64-apple-darwin would map to arm64 and result in wrong assembly regex generating garbage. I assumed the prefix match is there for a reason.

)
builder.processed_prefixes(prefixes)

func_dict = builder.finish_and_get_func_dict()
Expand Down