diff --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/asm-show-inst.ll.expected b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/asm-show-inst.ll.expected --- a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/asm-show-inst.ll.expected +++ b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/asm-show-inst.ll.expected @@ -6,17 +6,17 @@ define i8 @add_i8(i8 %a) nounwind { ; VERBOSE-LABEL: add_i8: ; VERBOSE: # %bb.0: -; VERBOSE-NEXT: movb {{[0-9]+}}(%esp), %al # -; VERBOSE-NEXT: # +; VERBOSE-NEXT: movb {{[0-9]+}}(%esp), %al # +; VERBOSE-NEXT: # ; VERBOSE-NEXT: # -; VERBOSE-NEXT: # +; VERBOSE-NEXT: # ; VERBOSE-NEXT: # -; VERBOSE-NEXT: # > -; VERBOSE-NEXT: addb $2, %al # > +; VERBOSE-NEXT: addb $2, %al # > -; VERBOSE-NEXT: retl # > +; VERBOSE-NEXT: retl # > ; ; CHECK-LABEL: add_i8: ; CHECK: # %bb.0: @@ -30,19 +30,19 @@ define i32 @add_i32(i32 %a) nounwind { ; VERBOSE-LABEL: add_i32: ; VERBOSE: # %bb.0: -; VERBOSE-NEXT: movl {{[0-9]+}}(%esp), %eax # -; VERBOSE-NEXT: # +; VERBOSE-NEXT: movl {{[0-9]+}}(%esp), %eax # +; VERBOSE-NEXT: # ; VERBOSE-NEXT: # -; VERBOSE-NEXT: # +; VERBOSE-NEXT: # ; VERBOSE-NEXT: # -; VERBOSE-NEXT: # > -; VERBOSE-NEXT: addl $2, %eax # -; VERBOSE-NEXT: # +; VERBOSE-NEXT: # > +; VERBOSE-NEXT: addl $2, %eax # +; VERBOSE-NEXT: # ; VERBOSE-NEXT: # > -; VERBOSE-NEXT: retl # > +; VERBOSE-NEXT: retl # > ; ; CHECK-LABEL: add_i32: ; CHECK: # %bb.0: diff --git a/llvm/utils/UpdateTestChecks/asm.py b/llvm/utils/UpdateTestChecks/asm.py --- a/llvm/utils/UpdateTestChecks/asm.py +++ b/llvm/utils/UpdateTestChecks/asm.py @@ -221,6 +221,8 @@ SCRUB_X86_RIP_RE = re.compile(r'[.\w]+\(%rip\)') SCRUB_X86_LCP_RE = re.compile(r'\.?LCPI[0-9]+_[0-9]+') SCRUB_X86_RET_RE = re.compile(r'ret[l|q]') +SCRUB_MCINST_IDENTIFIER_RE = re.compile(r'') def scrub_asm_x86(asm, args): # Scrub runs of whitespace out of the assembly, but leave the leading @@ -423,11 +425,16 @@ asm = common.SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm) return asm +def scrub_show_inst(real_scrubber, asm, args): + # Remove all MCInst/MCRegister identifiers + asm = SCRUB_MCINST_IDENTIFIER_RE.sub('', asm) + return real_scrubber(asm, args) # Returns a tuple of a scrub function and a function regex. Scrub function is -# used to alter function body in some way, for example, remove traling spaces. +# used to alter function body in some way, for example, remove trailing spaces. # Function regex is used to match function name, body, etc. in raw llc output. -def get_run_handler(triple): +def get_run_handler(triple, llc_args): target_handlers = { 'i686': (scrub_asm_x86, ASM_FUNCTION_X86_RE), 'x86': (scrub_asm_x86, ASM_FUNCTION_X86_RE), @@ -477,6 +484,9 @@ if handler is None: raise KeyError('Triple %r is not supported' % (triple)) + if '--asm-show-inst' in llc_args: + return lambda asm, args: scrub_show_inst(handler[0], asm, args), handler[1] + return handler ##### Generator of assembly CHECK lines diff --git a/llvm/utils/UpdateTestChecks/isel.py b/llvm/utils/UpdateTestChecks/isel.py --- a/llvm/utils/UpdateTestChecks/isel.py +++ b/llvm/utils/UpdateTestChecks/isel.py @@ -30,7 +30,7 @@ isel = common.SCRUB_TRAILING_WHITESPACE_RE.sub(r'', isel) return isel -def get_run_handler(triple): +def get_run_handler(triple, llc_args): target_handlers = { } handler = None diff --git a/llvm/utils/update_llc_test_checks.py b/llvm/utils/update_llc_test_checks.py --- a/llvm/utils/update_llc_test_checks.py +++ b/llvm/utils/update_llc_test_checks.py @@ -134,7 +134,7 @@ from UpdateTestChecks import isel as output_type else: from UpdateTestChecks import asm as output_type - scrubber, function_re = output_type.get_run_handler(triple) + scrubber, function_re = output_type.get_run_handler(triple, llc_args) builder.process_run_line(function_re, scrubber, raw_tool_output, prefixes, True) func_dict = builder.finish_and_get_func_dict()