[llvm] r316088 - update_mir_test_checks: Do a better job of disambiguating names

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 18 08:37:09 PDT 2017


Author: bogner
Date: Wed Oct 18 08:37:09 2017
New Revision: 316088

URL: http://llvm.org/viewvc/llvm-project?rev=316088&view=rev
Log:
update_mir_test_checks: Do a better job of disambiguating names

Matching prefixes isn't good enough, because it leads to things like
calling the first constant C3 just because there were two copies
before it. Tighten up the check to match more precisely, but also be
careful about ambiguity when dealing with target opcodes that end in a
number.

Modified:
    llvm/trunk/utils/update_mir_test_checks.py

Modified: llvm/trunk/utils/update_mir_test_checks.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/update_mir_test_checks.py?rev=316088&r1=316087&r2=316088&view=diff
==============================================================================
--- llvm/trunk/utils/update_mir_test_checks.py (original)
+++ llvm/trunk/utils/update_mir_test_checks.py Wed Oct 18 08:37:09 2017
@@ -266,10 +266,13 @@ def mangle_vreg(opcode, current_names):
                 INSERT_VECTOR_ELT='IVEC',
                 EXTRACT_VECTOR_ELT='EVEC',
                 SHUFFLE_VECTOR='SHUF').get(base, base)
+    # Avoid ambiguity when opcodes end in numbers
+    if len(base.rstrip('0123456789')) < len(base):
+        base += '_'
 
     i = 0
     for name in current_names:
-        if name.startswith(base):
+        if name.rstrip('0123456789') == base:
             i += 1
     if i:
         return '{}{}'.format(base, i)




More information about the llvm-commits mailing list