X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=utils%2Fupdate_llc_test_checks.py;h=cfdf830907f50b91f29016359ace28af40b35449;hb=8d5b76e5d406829f7049dfb6cc6e772e137ed2f0;hp=4125ea981ec1543ae00dfb71ebe65ced9c399180;hpb=ecf84c112420bc10ecd49985668dfb371c05b20b;p=oota-llvm.git diff --git a/utils/update_llc_test_checks.py b/utils/update_llc_test_checks.py index 4125ea981ec..cfdf830907f 100755 --- a/utils/update_llc_test_checks.py +++ b/utils/update_llc_test_checks.py @@ -24,6 +24,7 @@ def llc(args, cmd_args, ir): ASM_SCRUB_WHITESPACE_RE = re.compile(r'(?!^(| \w))[ \t]+', flags=re.M) +ASM_SCRUB_TRAILING_WHITESPACE_RE = re.compile(r'[ \t]+$', flags=re.M) ASM_SCRUB_SHUFFLES_RE = ( re.compile( r'^(\s*\w+) [^#\n]+#+ ((?:[xyz]mm\d+|mem) = .*)$', @@ -47,6 +48,8 @@ def scrub_asm(asm): asm = ASM_SCRUB_RIP_RE.sub(r'{{.*}}(%rip)', asm) # Strip kill operands inserted into the asm. asm = ASM_SCRUB_KILL_COMMENT_RE.sub('', asm) + # Strip trailing whitespace. + asm = ASM_SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm) return asm @@ -66,10 +69,12 @@ def main(): asm_function_re = re.compile( r'^_?(?P[^:]+):[ \t]*#+[ \t]*@(?P=f)\n[^:]*?' r'(?P^##?[ \t]+[^:]+:.*?)\s*' - r'^\s*(?:[^:\n]+?:\s*\n\s*\.size|\.cfi_endproc|\.globl|\.(?:sub)?section)', + r'^\s*(?:[^:\n]+?:\s*\n\s*\.size|\.cfi_endproc|\.globl|\.comm|\.(?:sub)?section)', flags=(re.M | re.S)) check_prefix_re = re.compile('--check-prefix=(\S+)') check_re = re.compile(r'^\s*;\s*([^:]+?)(?:-NEXT|-NOT|-DAG|-LABEL)?:') + autogenerated_note = ('; NOTE: Assertions have been autogenerated by ' + 'utils/update_llc_test_checks.py') for test in args.tests: if args.verbose: @@ -122,6 +127,9 @@ def main(): continue f = m.group('f') f_asm = scrub_asm(m.group('body')) + if f.startswith('stress'): + # We only use the last line of the asm for stress tests. + f_asm = '\n'.join(f_asm.splitlines()[-1:]) if args.verbose: print >>sys.stderr, 'Processing asm for function: ' + f for l in f_asm.splitlines(): @@ -130,7 +138,7 @@ def main(): if f in asm[prefix] and asm[prefix][f] != f_asm: if prefix == prefixes[-1]: print >>sys.stderr, ('WARNING: Found conflicting asm under the ' - 'same prefix!') + 'same prefix: %r!' % (prefix,)) else: asm[prefix][f] = None continue @@ -143,6 +151,8 @@ def main(): if args.verbose: print >>sys.stderr, 'Rewriting FileCheck prefixes: %s' % (prefix_set,) fixed_lines = [] + fixed_lines.append(autogenerated_note) + for l in test_lines: if is_in_function_start: if l.lstrip().startswith(';'): @@ -185,6 +195,8 @@ def main(): is_in_function = False continue + if l == autogenerated_note: + continue fixed_lines.append(l) m = ir_function_re.match(l)