[llvm] fc1e5f9 - update_test_checks: simplify is_local_def_ir_value

Nicolai Hähnle via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 7 18:58:50 PST 2024


Author: Nicolai Hähnle
Date: 2024-03-08T03:58:11+01:00
New Revision: fc1e5f978561d6357083f9b5bc981e52d93374b3

URL: https://github.com/llvm/llvm-project/commit/fc1e5f978561d6357083f9b5bc981e52d93374b3
DIFF: https://github.com/llvm/llvm-project/commit/fc1e5f978561d6357083f9b5bc981e52d93374b3.diff

LOG: update_test_checks: simplify is_local_def_ir_value

The match argument is unused.

Added: 
    

Modified: 
    llvm/utils/UpdateTestChecks/common.py

Removed: 
    


################################################################################
diff  --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py
index 53777523ec2a58..72d21cf4ca7dbc 100644
--- a/llvm/utils/UpdateTestChecks/common.py
+++ b/llvm/utils/UpdateTestChecks/common.py
@@ -933,7 +933,7 @@ def __init__(
         self.variable_mapping = {}
 
     # Return true if this kind of IR value is "local", basically if it matches '%{{.*}}'.
-    def is_local_def_ir_value_match(self, match):
+    def is_local_def_ir_value(self):
         return self.ir_prefix == "%"
 
     # Return true if this kind of IR value is "global", basically if it matches '#{{.*}}'.
@@ -949,7 +949,7 @@ def get_ir_prefix_from_ir_value_match(self, match):
     # Return the IR regexp we use for this kind or IR value, e.g., [\w.-]+? for locals
     def get_ir_regex_from_ir_value_re_match(self, match):
         # for backwards compatibility we check locals with '.*'
-        if self.is_local_def_ir_value_match(match):
+        if self.is_local_def_ir_value():
             return ".*"
         return self.ir_regexp
 
@@ -990,7 +990,7 @@ def get_value_definition(self, var, match):
         else:
             regex = self.get_ir_regex_from_ir_value_re_match(match)
             capture_start = "[["
-        if self.is_local_def_ir_value_match(match):
+        if self.is_local_def_ir_value():
             return capture_start + varname + ":" + prefix + regex + "]]"
         return prefix + capture_start + varname + ":" + regex + "]]"
 
@@ -999,7 +999,7 @@ def get_value_use(self, var, match, var_prefix=None):
         if var_prefix is None:
             var_prefix = self.check_prefix
         capture_start = "[[#" if self.is_number else "[["
-        if self.is_local_def_ir_value_match(match):
+        if self.is_local_def_ir_value():
             return capture_start + self.get_value_name(var, var_prefix) + "]]"
         prefix = self.get_ir_prefix_from_ir_value_match(match)[0]
         return prefix + capture_start + self.get_value_name(var, var_prefix) + "]]"
@@ -1209,7 +1209,7 @@ def transform_line_vars(match):
                 " with scripted FileCheck name." % (var,)
             )
         key = (var, nameless_value.check_key)
-        is_local_def = nameless_value.is_local_def_ir_value_match(match)
+        is_local_def = nameless_value.is_local_def_ir_value()
         if is_local_def and key in vars_seen:
             rv = nameless_value.get_value_use(var, match)
         elif not is_local_def and key in global_vars_seen:


        


More information about the llvm-commits mailing list