diff options
| author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-04-05 10:48:38 +0000 |
|---|---|---|
| committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-04-05 10:48:38 +0000 |
| commit | 829622982602a56e67f6f1262f726a4c1b4bb455 (patch) | |
| tree | 15c71f23d4909ce209e30b06c2f16760ccf6bfb1 /llvm/utils | |
| parent | 6e0043365b0d902d597ee8611e2acec21966b4b7 (diff) | |
| download | bcm5719-llvm-829622982602a56e67f6f1262f726a4c1b4bb455.tar.gz bcm5719-llvm-829622982602a56e67f6f1262f726a4c1b4bb455.zip | |
[UpdateTestChecks] Moved core functionality of add_asm_checks into add_checks
As discussed on D45272
llvm-svn: 329270
Diffstat (limited to 'llvm/utils')
| -rw-r--r-- | llvm/utils/UpdateTestChecks/asm.py | 24 | ||||
| -rw-r--r-- | llvm/utils/UpdateTestChecks/common.py | 16 |
2 files changed, 13 insertions, 27 deletions
diff --git a/llvm/utils/UpdateTestChecks/asm.py b/llvm/utils/UpdateTestChecks/asm.py index aa7e245eb8c..0e93b194be9 100644 --- a/llvm/utils/UpdateTestChecks/asm.py +++ b/llvm/utils/UpdateTestChecks/asm.py @@ -218,26 +218,4 @@ def build_function_body_dictionary_for_triple(args, raw_tool_output, triple, pre def add_asm_checks(output_lines, comment_marker, prefix_list, func_dict, func_name): # Label format is based on ASM string. check_label_format = '{} %s-LABEL: %s:'.format(comment_marker) - - printed_prefixes = [] - for p in prefix_list: - checkprefixes = p[0] - for checkprefix in checkprefixes: - if checkprefix in printed_prefixes: - break - # TODO func_dict[checkprefix] may be None, '' or not exist. - # Fix the call sites. - if func_name not in func_dict[checkprefix] or not func_dict[checkprefix][func_name]: - continue - # Add some space between different check prefixes. - if len(printed_prefixes) != 0: - output_lines.append(comment_marker) - printed_prefixes.append(checkprefix) - output_lines.append(check_label_format % (checkprefix, func_name)) - func_body = func_dict[checkprefix][func_name].splitlines() - - output_lines.append('%s %s: %s' % (comment_marker, checkprefix, func_body[0])) - for func_line in func_body[1:]: - output_lines.append('%s %s-NEXT: %s' % (comment_marker, checkprefix, func_line)) - - break + common.add_checks(output_lines, comment_marker, prefix_list, func_dict, func_name, check_label_format, True) diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py index 12b88a98f1e..8480c8cf14c 100644 --- a/llvm/utils/UpdateTestChecks/common.py +++ b/llvm/utils/UpdateTestChecks/common.py @@ -156,7 +156,7 @@ def genericize_check_lines(lines): return lines -def add_checks(output_lines, comment_marker, prefix_list, func_dict, func_name, check_label_format): +def add_checks(output_lines, comment_marker, prefix_list, func_dict, func_name, check_label_format, is_asm): printed_prefixes = [] for p in prefix_list: checkprefixes = p[0] @@ -170,13 +170,21 @@ def add_checks(output_lines, comment_marker, prefix_list, func_dict, func_name, # Add some space between different check prefixes, but not after the last # check line (before the test code). - #if len(printed_prefixes) != 0: - # output_lines.append(comment_marker) + if is_asm == True: + if len(printed_prefixes) != 0: + output_lines.append(comment_marker) printed_prefixes.append(checkprefix) output_lines.append(check_label_format % (checkprefix, func_name)) func_body = func_dict[checkprefix][func_name].splitlines() + # For ASM output, just emit the check lines. + if is_asm == True: + output_lines.append('%s %s: %s' % (comment_marker, checkprefix, func_body[0])) + for func_line in func_body[1:]: + output_lines.append('%s %s-NEXT: %s' % (comment_marker, checkprefix, func_line)) + break + # For IR output, change all defs to FileCheck variables, so we're immune # to variable naming fashions. func_body = genericize_check_lines(func_body) @@ -218,4 +226,4 @@ def add_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): # 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) + add_checks(output_lines, comment_marker, prefix_list, func_dict, func_name, check_label_format, False) |

