[llvm] UpdateTestChecks: Don't check meta details in func definition w/--global none (PR #124205)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 23 15:22:02 PST 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 e1aa1e43decf9275175845bea970ef6d7c2b1af6...0752d400441e7e35f977e6afa2c751ee3fdcb395 llvm/utils/UpdateTestChecks/common.py llvm/utils/update_cc_test_checks.py llvm/utils/update_test_checks.py
``````````

</details>

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

``````````diff
--- UpdateTestChecks/common.py	2025-01-23 21:53:53.000000 +0000
+++ UpdateTestChecks/common.py	2025-01-23 23:21:29.569601 +0000
@@ -980,11 +980,11 @@
 
 
 ##### Generator of LLVM IR CHECK lines
 
 SCRUB_IR_COMMENT_RE = re.compile(r"\s*;.*")
-SCRUB_IR_FUNC_META_RE = re.compile(r'((?:\!(?!dbg\b)[a-zA-Z_]\w*(?:\s+![0-9]+)?)\s*)+')
+SCRUB_IR_FUNC_META_RE = re.compile(r"((?:\!(?!dbg\b)[a-zA-Z_]\w*(?:\s+![0-9]+)?)\s*)+")
 
 # TODO: We should also derive check lines for global, debug, loop declarations, etc..
 
 
 class NamelessValue:
@@ -1085,11 +1085,11 @@
         version,
         mode,
         nameless_values: List[NamelessValue],
         regexp_prefix,
         regexp_suffix,
-        no_meta_details = False
+        no_meta_details=False,
     ):
         self._version = version
         self._mode = mode
         self._nameless_values = nameless_values
 
@@ -1227,11 +1227,13 @@
     #     for nameless_value in IR_NAMELESS_VALUES
     #     if not (globals_only and nameless_value.global_ir_rhs_regexp is None) and
     #        not (unstable_ids_only and nameless_value.match_literally)
     # ]
 
-    return GeneralizerInfo(version, GeneralizerInfo.MODE_IR, values, prefix, suffix, no_meta_details)
+    return GeneralizerInfo(
+        version, GeneralizerInfo.MODE_IR, values, prefix, suffix, no_meta_details
+    )
 
 
 def make_asm_generalizer(version):
     values = [
         NamelessValue(
@@ -1729,11 +1731,11 @@
     global_vars_seen,
     preserve_names=False,
     original_check_lines=None,
     *,
     unstable_globals_only=False,
-    no_meta_details = False,
+    no_meta_details=False,
 ):
     if unstable_globals_only:
         regexp = ginfo.get_unstable_globals_regexp()
     else:
         regexp = ginfo.get_regexp()
@@ -1761,11 +1763,11 @@
                     break
             # Ignore any comments, since the check lines will too.
             scrubbed_line = SCRUB_IR_COMMENT_RE.sub(r"", line)
             # Ignore the metadata details if check global is none
             if no_meta_details:
-               scrubbed_line = SCRUB_IR_FUNC_META_RE.sub(r"{{.*}}", scrubbed_line)
+                scrubbed_line = SCRUB_IR_FUNC_META_RE.sub(r"{{.*}}", scrubbed_line)
             lines[i] = scrubbed_line
 
     if not preserve_names:
         committed_names = set(
             test_var.get_variable_name(name)
@@ -1993,11 +1995,11 @@
                     ginfo,
                     vars_seen,
                     global_vars_seen,
                     preserve_names,
                     original_check_lines=[],
-                    no_meta_details=ginfo.no_meta_details()
+                    no_meta_details=ginfo.no_meta_details(),
                 )[0]
             func_name_separator = func_dict[checkprefix][func_name].func_name_separator
             if "[[" in args_and_sig:
                 # Captures in label lines are not supported, thus split into a -LABEL
                 # and a separate -SAME line that contains the arguments with captures.
--- update_cc_test_checks.py	2025-01-23 21:53:53.000000 +0000
+++ update_cc_test_checks.py	2025-01-23 23:21:29.787131 +0000
@@ -366,11 +366,13 @@
 
         # Execute clang, generate LLVM IR, and extract functions.
 
         # Store only filechecked runlines.
         filecheck_run_list = [i for i in run_list if i[0]]
-        ginfo = common.make_ir_generalizer(ti.args.version, ti.args.check_globals == "none")
+        ginfo = common.make_ir_generalizer(
+            ti.args.version, ti.args.check_globals == "none"
+        )
         builder = common.FunctionTestBuilder(
             run_list=filecheck_run_list,
             flags=ti.args,
             scrubber_args=[],
             path=ti.path,
--- update_test_checks.py	2025-01-23 21:53:53.000000 +0000
+++ update_test_checks.py	2025-01-23 23:21:29.887926 +0000
@@ -151,11 +151,13 @@
 
             # FIXME: We should use multiple check prefixes to common check lines. For
             # now, we just ignore all but the last.
             prefix_list.append((check_prefixes, tool_cmd_args, preprocess_cmd))
 
-        ginfo = common.make_ir_generalizer(ti.args.version, ti.args.check_globals == "none")
+        ginfo = common.make_ir_generalizer(
+            ti.args.version, ti.args.check_globals == "none"
+        )
         global_vars_seen_dict = {}
         builder = common.FunctionTestBuilder(
             run_list=prefix_list,
             flags=ti.args,
             scrubber_args=[],

``````````

</details>


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


More information about the llvm-commits mailing list