[PATCH] D68081: Allow update_test_checks.py to not scrub names

David Greene via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 26 05:01:25 PDT 2019


greened created this revision.
greened added reviewers: xbolva00, MaskRay, reames, RKSimon, spatel.
greened added a project: LLVM.
Herald added a subscriber: llvm-commits.

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 keep the names to
identify the instruction.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68081

Files:
  llvm/utils/UpdateTestChecks/common.py
  llvm/utils/update_test_checks.py


Index: llvm/utils/update_test_checks.py
===================================================================
--- llvm/utils/update_test_checks.py
+++ llvm/utils/update_test_checks.py
@@ -64,6 +64,8 @@
       '--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 @@
             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:
Index: llvm/utils/UpdateTestChecks/common.py
===================================================================
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -270,10 +270,12 @@
       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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68081.221923.patch
Type: text/x-patch
Size: 1990 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190926/db7c025e/attachment-0001.bin>


More information about the llvm-commits mailing list