[llvm] r327538 - Fix LLVM IR check lines in utils/update_cc_test_checks.py

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 14 10:47:07 PDT 2018


Author: maskray
Date: Wed Mar 14 10:47:07 2018
New Revision: 327538

URL: http://llvm.org/viewvc/llvm-project?rev=327538&view=rev
Log:
Fix LLVM IR check lines in utils/update_cc_test_checks.py

Reviewers: arichardson

Subscribers: llvm-commits

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

Modified:
    llvm/trunk/utils/UpdateTestChecks/common.py
    llvm/trunk/utils/update_cc_test_checks.py
    llvm/trunk/utils/update_test_checks.py

Modified: llvm/trunk/utils/UpdateTestChecks/common.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/UpdateTestChecks/common.py?rev=327538&r1=327537&r2=327538&view=diff
==============================================================================
--- llvm/trunk/utils/UpdateTestChecks/common.py (original)
+++ llvm/trunk/utils/UpdateTestChecks/common.py Wed Mar 14 10:47:07 2018
@@ -155,12 +155,13 @@ def genericize_check_lines(lines):
   return lines
 
 
-def add_ir_checks(output_lines, prefix_list, func_dict, func_name, opt_basename):
+def add_ir_checks(output_lines, comment_marker, prefix_list, func_dict, func_name):
   # Label format is based on IR string.
-  check_label_format = "; %s-LABEL: @%s("
+  check_label_format = '{} %s-LABEL: @%s('.format(comment_marker)
 
   printed_prefixes = []
-  for checkprefixes, _ in prefix_list:
+  for p in prefix_list:
+    checkprefixes = p[0]
     for checkprefix in checkprefixes:
       if checkprefix in printed_prefixes:
         break
@@ -200,13 +201,15 @@ def add_ir_checks(output_lines, prefix_l
 
         # Skip blank lines instead of checking them.
         if is_blank_line == True:
-          output_lines.append('; %s:       %s' % (checkprefix, func_line))
+          output_lines.append('{} {}:       {}'.format(
+              comment_marker, checkprefix, func_line))
         else:
-          output_lines.append('; %s-NEXT:  %s' % (checkprefix, func_line))
+          output_lines.append('{} {}-NEXT:  {}'.format(
+              comment_marker, checkprefix, func_line))
         is_blank_line = False
 
       # Add space between different check prefixes and also before the first
       # line of code in the test function.
-      output_lines.append(';')
+      output_lines.append(comment_marker)
       break
   return output_lines

Modified: llvm/trunk/utils/update_cc_test_checks.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/update_cc_test_checks.py?rev=327538&r1=327537&r2=327538&view=diff
==============================================================================
--- llvm/trunk/utils/update_cc_test_checks.py (original)
+++ llvm/trunk/utils/update_cc_test_checks.py Wed Mar 14 10:47:07 2018
@@ -226,8 +226,7 @@ def main():
             if added:
               output_lines.append('//')
             added.add(mangled)
-            # This is also used for adding IR CHECK lines.
-            asm.add_asm_checks(output_lines, '//', run_list, func_dict, mangled)
+            common.add_ir_checks(output_lines, '//', run_list, func_dict, mangled)
       output_lines.append(line.rstrip('\n'))
 
     # Update the test file.

Modified: llvm/trunk/utils/update_test_checks.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/update_test_checks.py?rev=327538&r1=327537&r2=327538&view=diff
==============================================================================
--- llvm/trunk/utils/update_test_checks.py (original)
+++ llvm/trunk/utils/update_test_checks.py Wed Mar 14 10:47:07 2018
@@ -146,7 +146,7 @@ def main():
             continue
 
         # Print out the various check lines here.
-        output_lines = common.add_ir_checks(output_lines, prefix_list, func_dict, func_name, opt_basename)
+        output_lines = common.add_ir_checks(output_lines, ';', prefix_list, func_dict, func_name)
         is_in_function_start = False
 
       if is_in_function:




More information about the llvm-commits mailing list