[llvm] r317509 - update_mir_test_checks: Be careful about replacing entire vregs

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 6 13:06:09 PST 2017


Author: bogner
Date: Mon Nov  6 13:06:09 2017
New Revision: 317509

URL: http://llvm.org/viewvc/llvm-project?rev=317509&view=rev
Log:
update_mir_test_checks: Be careful about replacing entire vregs

Previously, this could end up replacing a vreg like %14 with
[[VREG1]]4, where VREG1 was the match for %1. That's obviously not
correct, though it hasn't actually come up in any tests I've converted
so far.

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=317509&r1=317508&r2=317509&view=diff
==============================================================================
--- llvm/trunk/utils/update_mir_test_checks.py (original)
+++ llvm/trunk/utils/update_mir_test_checks.py Mon Nov  6 13:06:09 2017
@@ -254,7 +254,8 @@ def add_check_lines(test, output_lines,
                 func_line = func_line.replace(
                     vreg.group(1), '[[{}:%[0-9]+]]'.format(name), 1)
         for number, name in vreg_map.items():
-            func_line = func_line.replace(number, '[[{}]]'.format(name))
+            func_line = re.sub(r'{}\b'.format(number), '[[{}]]'.format(name),
+                               func_line)
         check_line = '{}: {}'.format(check, func_line[indent:]).rstrip()
         output_lines.append(check_line)
 




More information about the llvm-commits mailing list