From 131e1c17a86eacfb783b1b17ebe81827d01ea0fe Mon Sep 17 00:00:00 2001 From: David Greene Date: Mon, 7 Oct 2019 14:37:20 +0000 Subject: [PATCH] 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373912 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/UpdateTestChecks/common.py | 6 ++++-- utils/update_test_checks.py | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/utils/UpdateTestChecks/common.py b/utils/UpdateTestChecks/common.py index ecb3a0f0a72..972b65505b4 100644 --- a/utils/UpdateTestChecks/common.py +++ b/utils/UpdateTestChecks/common.py @@ -267,10 +267,12 @@ def add_checks(output_lines, comment_marker, prefix_list, func_dict, func_name, 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) diff --git a/utils/update_test_checks.py b/utils/update_test_checks.py index 5e0d4bac22f..ec026022fc2 100755 --- a/utils/update_test_checks.py +++ b/utils/update_test_checks.py @@ -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: -- 2.11.4.GIT