[Mlir-commits] [mlir] dbf798f - [mlir] Fix generating checks for multiple funcs in generate-test-checks

Benjamin Maxwell llvmlistbot at llvm.org
Thu Aug 3 09:02:14 PDT 2023


Author: Benjamin Maxwell
Date: 2023-08-03T15:55:03Z
New Revision: dbf798fa646811c03e40c25f9bb3a456267c5a73

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

LOG: [mlir] Fix generating checks for multiple funcs in generate-test-checks

This regressed in D154458 due to the added tracking of used variable
names that now also has to be cleared alongside the counter.

Reviewed By: rafaelubalmw, c-rhodes, awarzynski

Differential Revision: https://reviews.llvm.org/D156547

Added: 
    

Modified: 
    mlir/utils/generate-test-checks.py

Removed: 
    


################################################################################
diff  --git a/mlir/utils/generate-test-checks.py b/mlir/utils/generate-test-checks.py
index 2f3293952af637..8faa425beace1d 100755
--- a/mlir/utils/generate-test-checks.py
+++ b/mlir/utils/generate-test-checks.py
@@ -72,7 +72,7 @@ def __init__(self, variable_names):
         self.variable_names = [name.upper() for name in variable_names.split(',')]
         self.used_variable_names = set()
 
-    # Generate the following 'n' variable names in the parent scope. 
+    # Generate the following 'n' variable names in the parent scope.
     def generate_in_parent_scope(self, n):
         self.generate_in_parent_scope_left = n
 
@@ -112,9 +112,10 @@ def pop_name_scope(self):
     def num_scopes(self):
         return len(self.scopes)
 
-    # Reset the counter.
-    def clear_counter(self):
+    # Reset the counter and used variable names.
+    def clear_names(self):
         self.name_counter = 0
+        self.used_variable_names = set()
 
 class AttributeNamer:
 
@@ -123,7 +124,7 @@ def __init__(self, attribute_names):
         self.attribute_names = [name.upper() for name in attribute_names.split(',')]
         self.map = {}
         self.used_attribute_names = set()
-    
+
     # Generate a substitution name for the given attribute name.
     def generate_name(self, source_attribute_name):
 
@@ -342,7 +343,7 @@ def main():
             variable_namer.push_name_scope()
             if cur_level == args.starts_from_scope:
                 output_segments.append([])
-           
+
             # Result SSA values must still be pushed to parent scope
             num_ssa_results = get_num_ssa_results(input_line)
             variable_namer.generate_in_parent_scope(num_ssa_results)
@@ -352,7 +353,7 @@ def main():
             continue
 
         if len(output_segments[-1]) == 0:
-            variable_namer.clear_counter()
+            variable_namer.clear_names()
 
         # Preprocess the input to remove any sequences that may be problematic with
         # FileCheck.


        


More information about the Mlir-commits mailing list