[llvm] r373912 - Allow update_test_checks.py to not scrub names.

David Greene via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 7 07:37:20 PDT 2019


Author: greened
Date: Mon Oct  7 07:37:20 2019
New Revision: 373912

URL: http://llvm.org/viewvc/llvm-project?rev=373912&view=rev
Log:
Allow update_test_checks.py to not scrub names.

Add a --preserve-names option to tell the script not to replace IR names.
Sometimes tests want those names.  For example if a test is looking for a
modification to an existing instruction we'll want to make the names.

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

Modified:
    llvm/trunk/utils/UpdateTestChecks/common.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=373912&r1=373911&r2=373912&view=diff
==============================================================================
--- llvm/trunk/utils/UpdateTestChecks/common.py (original)
+++ llvm/trunk/utils/UpdateTestChecks/common.py Mon Oct  7 07:37:20 2019
@@ -267,10 +267,12 @@ def add_checks(output_lines, comment_mar
       output_lines.append(comment_marker)
       break
 
-def add_ir_checks(output_lines, comment_marker, prefix_list, func_dict, func_name):
+def add_ir_checks(output_lines, comment_marker, prefix_list, func_dict,
+                  func_name, preserve_names):
   # Label format is based on IR string.
   check_label_format = '{} %s-LABEL: @%s('.format(comment_marker)
-  add_checks(output_lines, comment_marker, prefix_list, func_dict, func_name, check_label_format, False, False)
+  add_checks(output_lines, comment_marker, prefix_list, func_dict, func_name,
+             check_label_format, False, preserve_names)
 
 def add_analyze_checks(output_lines, comment_marker, prefix_list, func_dict, func_name):
   check_label_format = '{} %s-LABEL: \'%s\''.format(comment_marker)

Modified: llvm/trunk/utils/update_test_checks.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/update_test_checks.py?rev=373912&r1=373911&r2=373912&view=diff
==============================================================================
--- llvm/trunk/utils/update_test_checks.py (original)
+++ llvm/trunk/utils/update_test_checks.py Mon Oct  7 07:37:20 2019
@@ -64,6 +64,8 @@ def main():
       '--function', help='The function in the test file to update')
   parser.add_argument('-u', '--update-only', action='store_true',
                       help='Only update test if it was already autogened')
+  parser.add_argument('-p', '--preserve-names', action='store_true',
+                      help='Do not scrub IR names')
   parser.add_argument('tests', nargs='+')
   args = parser.parse_args()
 
@@ -174,7 +176,8 @@ def main():
             continue
 
         # Print out the various check lines here.
-        common.add_ir_checks(output_lines, ';', prefix_list, func_dict, func_name)
+        common.add_ir_checks(output_lines, ';', prefix_list, func_dict,
+                             func_name, args.preserve_names)
         is_in_function_start = False
 
       if is_in_function:




More information about the llvm-commits mailing list