summaryrefslogtreecommitdiffstats
path: root/llvm/utils/update_llc_test_checks.py
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/utils/update_llc_test_checks.py')
-rwxr-xr-xllvm/utils/update_llc_test_checks.py23
1 files changed, 20 insertions, 3 deletions
diff --git a/llvm/utils/update_llc_test_checks.py b/llvm/utils/update_llc_test_checks.py
index 9f74a2e1899..1f7d939155e 100755
--- a/llvm/utils/update_llc_test_checks.py
+++ b/llvm/utils/update_llc_test_checks.py
@@ -38,10 +38,13 @@ def main():
help='Use more regex for x86 matching to reduce diffs between various subtargets')
parser.add_argument(
'--no_x86_scrub_rip', action='store_false', dest='x86_scrub_rip')
+ parser.add_argument('-u', '--update-only', action='store_true',
+ help='Only update test if it was already autogened')
parser.add_argument('tests', nargs='+')
args = parser.parse_args()
- autogenerated_note = (ADVERT + 'utils/' + os.path.basename(__file__))
+ script_name = os.path.basename(__file__)
+ autogenerated_note = (ADVERT + 'utils/' + script_name)
test_paths = [test for pattern in args.tests for test in glob.glob(pattern)]
for test in test_paths:
@@ -49,6 +52,16 @@ def main():
print('Scanning for RUN lines in test file: %s' % (test,), file=sys.stderr)
with open(test) as f:
input_lines = [l.rstrip() for l in f]
+
+ first_line = input_lines[0] if input_lines else ""
+ if 'autogenerated' in first_line and script_name not in first_line:
+ common.warn("Skipping test which wasn't autogenerated by " + script_name, test)
+ continue
+
+ if args.update_only:
+ if not first_line or 'autogenerated' not in first_line:
+ common.warn("Skipping test which isn't autogenerated: " + test)
+ continue
triple_in_ir = None
for l in input_lines:
@@ -73,6 +86,10 @@ def main():
run_list = []
for l in run_lines:
+ if '|' not in l:
+ common.warn('Skipping unparseable RUN line: ' + l)
+ continue
+
commands = [cmd.strip() for cmd in l.split('|', 1)]
llc_cmd = commands[0]
@@ -91,11 +108,11 @@ def main():
filecheck_cmd = commands[1]
common.verify_filecheck_prefixes(filecheck_cmd)
if not llc_cmd.startswith('llc '):
- print('WARNING: Skipping non-llc RUN line: ' + l, file=sys.stderr)
+ common.warn('Skipping non-llc RUN line: ' + l)
continue
if not filecheck_cmd.startswith('FileCheck '):
- print('WARNING: Skipping non-FileChecked RUN line: ' + l, file=sys.stderr)
+ common.warn('Skipping non-FileChecked RUN line: ' + l)
continue
llc_cmd_args = llc_cmd[len('llc'):].strip()
OpenPOWER on IntegriCloud