diff --git a/llvm/utils/update_cc_test_checks.py b/llvm/utils/update_cc_test_checks.py --- a/llvm/utils/update_cc_test_checks.py +++ b/llvm/utils/update_cc_test_checks.py @@ -88,6 +88,8 @@ help='Use more regex for x86 matching to reduce diffs between various subtargets') parser.add_argument('-u', '--update-only', action='store_true', help='Only update test if it was already autogened') + parser.add_argument('--allow-asm', action='store_true', + help='Accept machine asm in test checks') parser.add_argument('tests', nargs='+') args = parser.parse_args() args.clang_args = shlex.split(args.clang_args or '') @@ -120,6 +122,16 @@ common.build_function_body_dictionary( common.OPT_FUNCTION_RE, common.scrub_body, [], raw_tool_output, prefixes, func_dict, args.verbose) + elif args.allow_asm: + triple = triple_in_cmd + if not triple: + march_in_cmd = None + m = common.MARCH_ARG_RE.search('{}'.format(clang_args)) + if m: + march_in_cmd = m.groups()[0] + triple = asm.get_triple_from_march(march_in_cmd) + asm.build_function_body_dictionary_for_triple(args, raw_tool_output, + triple, prefixes, func_dict) else: print('The clang command line should include -emit-llvm as asm tests ' 'are discouraged in Clang testsuite.', file=sys.stderr) @@ -240,7 +252,10 @@ if added: output_lines.append('//') added.add(mangled) - common.add_ir_checks(output_lines, '//', run_list, func_dict, mangled) + if '-emit-llvm' in clang_args: + common.add_ir_checks(output_lines, '//', run_list, func_dict, mangled) + else: + asm.add_asm_checks(output_lines, '//', run_list, func_dict, mangled) output_lines.append(line.rstrip('\n')) # Update the test file.