Index: test/CodeGen/AArch64/test-update_mir_test_checks.py-itself.mir =================================================================== --- test/CodeGen/AArch64/test-update_mir_test_checks.py-itself.mir +++ test/CodeGen/AArch64/test-update_mir_test_checks.py-itself.mir @@ -13,6 +13,9 @@ # STDERR-SAME: sed -e {{.*}} RUN-NESTED{{.*}}SOURCE{{.*}}STDERR{{.*}}SOURCE # STDERR-NOT: WARNING +# SOURCE-LABEL: # NOTE: Assertions have been autogenerated by +# SOURCE-SAME: utils/update_mir_test_checks.py +# # SOURCE: WARNING # SOURCE-NEXT: WARNING # SOURCE-NEXT: sed Index: utils/update_mir_test_checks.py =================================================================== --- utils/update_mir_test_checks.py +++ utils/update_mir_test_checks.py @@ -29,6 +29,7 @@ RUN_LINE_RE = re.compile('^\s*[;#]\s*RUN:\s*(.*)$') TRIPLE_ARG_RE = re.compile(r'-mtriple[= ]([^ ]+)') MARCH_ARG_RE = re.compile(r'-march[= ]([^ ]+)') +LANG_ARG_RE = re.compile(r'-x[= ]([^ ]+)') TRIPLE_IR_RE = re.compile(r'^\s*target\s+triple\s*=\s*"([^"]+)"$') CHECK_PREFIX_RE = re.compile('--?check-prefix(?:es)?[= ](\S+)') CHECK_RE = re.compile(r'^\s*[;#]\s*([^:]+?)(?:-NEXT|-NOT|-DAG|-LABEL)?:') @@ -74,10 +75,11 @@ class Run: - def __init__(self, prefixes, cmd_args, triple): + def __init__(self, prefixes, cmd_args, triple, lang): self.prefixes = prefixes self.cmd_args = cmd_args self.triple = triple + self.lang = lang def __getitem__(self, index): return [self.prefixes, self.cmd_args, self.triple][index] @@ -143,6 +145,9 @@ if m and not triple: triple = '{}--'.format(m.group(1)) + m = LANG_ARG_RE.search(llc_cmd) + lang = (m.group(1) if m else test.split('.')[-1]).lower() + cmd_args = llc_cmd[len('llc'):].strip() cmd_args = cmd_args.replace('< %s', '').replace('%s', '').strip() @@ -152,7 +157,7 @@ check_prefixes = ['CHECK'] all_prefixes += check_prefixes - run_list.append(Run(check_prefixes, cmd_args, triple)) + run_list.append(Run(check_prefixes, cmd_args, triple, lang)) # Remove any common prefixes. We'll just leave those entirely alone. common_prefixes = set([prefix for prefix in all_prefixes @@ -344,7 +349,7 @@ warn('Ignoring common prefixes: {}'.format(common_prefixes), test_file=test) - comment_char = '#' if test.endswith('.mir') else ';' + comment_char = '#' if any(run.lang == 'mir' for run in run_list) else ';' autogenerated_note = ('{} NOTE: Assertions have been autogenerated by ' 'utils/{}'.format(comment_char, os.path.basename(__file__)))