[llvm] [utils][UpdateLLCTestChecks] Add MIR support to update_llc_test_checks.py. (PR #164965)

via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 24 05:23:37 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {darker}-->


:warning: Python code formatter, darker found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
darker --check --diff -r origin/main...HEAD llvm/utils/update_llc_test_checks.py
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from darker here.
</summary>

``````````diff
--- update_llc_test_checks.py	2025-10-24 11:54:04.000000 +0000
+++ update_llc_test_checks.py	2025-10-24 12:22:58.873332 +0000
@@ -15,21 +15,23 @@
 import os  # Used to advertise this file's name ("autogenerated_note").
 import re
 import sys
 
 from UpdateTestChecks import common
-import update_mir_test_checks # Reuse MIR parsing code.
+import update_mir_test_checks  # Reuse MIR parsing code.
 
 # llc is the only llc-like in the LLVM tree but downstream forks can add
 # additional ones here if they have them.
 LLC_LIKE_TOOLS = [
     "llc",
 ]
 
+
 def has_stop_pass_flag(llc_args):
     """Check if llc arguments contain -stop-before or -stop-after flag."""
-    return re.search(r'-stop-(?:before|after)=', llc_args) is not None
+    return re.search(r"-stop-(?:before|after)=", llc_args) is not None
+
 
 def update_test(ti: common.TestInfo):
     triple_in_ir = None
     for l in ti.input_lines:
         m = common.TRIPLE_IR_RE.match(l)
@@ -155,18 +157,25 @@
             common.debug("Detected MIR output mode for prefixes:", str(prefixes))
             # Initialize MIR func_dict for these prefixes.
             for prefix in prefixes:
                 if prefix not in mir_func_dict:
                     mir_func_dict[prefix] = {}
-            
+
             # Build MIR function dictionary using imported function.
             update_mir_test_checks.build_function_info_dictionary(
-                ti.path, raw_tool_output, triple, prefixes, mir_func_dict, ti.args.verbose
+                ti.path,
+                raw_tool_output,
+                triple,
+                prefixes,
+                mir_func_dict,
+                ti.args.verbose,
             )
-            
+
             # Store this run info for later.
-            mir_run_list.append((prefixes, llc_tool, llc_args, triple_in_cmd, march_in_cmd))
+            mir_run_list.append(
+                (prefixes, llc_tool, llc_args, triple_in_cmd, march_in_cmd)
+            )
         else:
             # Regular assembly output.
             scrubber, function_re = output_type.get_run_handler(triple)
             if 0 == builder.process_run_line(
                 function_re, scrubber, raw_tool_output, prefixes
@@ -245,25 +254,25 @@
                         ginfo,
                         global_vars_seen_dict,
                         is_filtered=builder.is_filtered(),
                     )
                 )
-                
+
                 # Also add MIR checks if we have them for this function
                 if mir_run_list and func_name:
                     common.add_mir_checks_for_function(
                         ti.path,
                         output_lines,
                         mir_run_list,
                         mir_func_dict,
                         func_name,
-                        single_bb=False, # Don't skip basic block labels.
-                        print_fixed_stack=False, # Don't print fixed stack (ASM tests don't need it).
-                        first_check_is_next=False, # First check is LABEL, not NEXT.
-                        at_the_function_name=False, # Use "name:" not "@name".
+                        single_bb=False,  # Don't skip basic block labels.
+                        print_fixed_stack=False,  # Don't print fixed stack (ASM tests don't need it).
+                        first_check_is_next=False,  # First check is LABEL, not NEXT.
+                        at_the_function_name=False,  # Use "name:" not "@name".
                     )
-                
+
                 is_in_function_start = False
 
             if is_in_function:
                 if common.should_add_line_to_output(input_line, prefix_set):
                     # This input line of the function body will go as-is into the output.

``````````

</details>


https://github.com/llvm/llvm-project/pull/164965


More information about the llvm-commits mailing list