[llvm] update_test_checks: improve IR value name stability (PR #110940)

Jannik Silvanus via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 4 03:14:46 PDT 2024


Nicolai =?utf-8?q?Hähnle?= <nicolai.haehnle at amd.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/110940 at github.com>


================
@@ -1554,39 +1575,62 @@ def diffify_line(line, mapper):
                     else:
                         break
 
-                if rhs_value.name in local_commits:
+                if rhs_value.name in new_color.mapping:
                     # Same, but for a possible commit happening on the same line
-                    if local_commits[rhs_value.name] == lhs_value.name:
+                    if new_color.color[rhs_value.name] == lhs_value.name:
                         continue
                     else:
                         break
 
-                if lhs_value.name in committed_names:
-                    # We can't map this value because the name we would map it to has already been
-                    # committed for something else. Give up on this line.
+                if lhs_value.name in committed_names or lhs_value.name in new_color.committed:
+                    # We can't map this value because the name we would map it
+                    # to has already been committed for something else. Give up
+                    # on this line.
                     break
 
-                local_commits[rhs_value.name] = lhs_value.name
-            else:
-                # No reason not to add any commitments for this line
-                for rhs_var, lhs_var in local_commits.items():
-                    new_mapping[rhs_var] = lhs_var
-                    committed_names.add(lhs_var)
-                    committed_anything = True
-
-                    if (
-                        lhs_var != rhs_var
-                        and lhs_var in new_mapping
-                        and new_mapping[lhs_var] == lhs_var
-                    ):
-                        new_mapping[lhs_var] = "conflict_" + lhs_var
+                new_color.mapping[rhs_value.name] = lhs_value.name
+                new_color.committed.add(lhs_value.name)
 
-                matches.append((lhs_idx, rhs_idx))
+                color_idx = 0
+                while color_idx < len(compatible_colors):
----------------
jasilvanus wrote:

Maybe add a comment that we now filter all compatible colors (but don't merge yet)

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


More information about the llvm-commits mailing list