Skip to content

Commit d3eccb5

Browse files
committed
update_mir_test_checks: Drop support for vreg block checks
Since vregs are printed in the instruction stream now, checking the vreg block is always redundant. Remove the temporary feature that allowed us to do that. This reverts r316134 llvm-svn: 326284
1 parent 19eedbf commit d3eccb5

File tree

1 file changed

+9
-24
lines changed

1 file changed

+9
-24
lines changed

llvm/utils/update_mir_test_checks.py

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
r'^ *(?P<vregs>{0}(?:, {0})*) '
4242
r'= (?P<opcode>[A-Zt][A-Za-z0-9_]+)'.format(VREG_RE.pattern))
4343
MIR_PREFIX_DATA_RE = re.compile(r'^ *(;|bb.[0-9].*: *$|[a-z]+:( |$)|$)')
44-
VREG_CLASS_RE = re.compile(r'^ *- *{ id: ([0-9]+), class: ([a-z0-9_]+)', re.M)
4544

4645
IR_FUNC_NAME_RE = re.compile(
4746
r'^\s*define\s+(?:internal\s+)?[^@]*@(?P<func>[A-Za-z0-9_.]+)\s*\(')
@@ -51,7 +50,6 @@
5150
r'^---$'
5251
r'\n'
5352
r'^ *name: *(?P<func>[A-Za-z0-9_.-]+)$'
54-
r'(?:.*?(?P<vregs>^ *registers: *(?:\n *- {[^\n]+$)*))?'
5553
r'.*?'
5654
r'^ *body: *\|\n'
5755
r'(?P<body>.*?)\n'
@@ -196,11 +194,10 @@ def build_function_body_dictionary(test, raw_tool_output, triple, prefixes,
196194
warn('Found conflicting asm for prefix: {}'.format(prefix),
197195
test_file=test)
198196
func_dict[prefix][func] = body
199-
func_dict[prefix]['{}:vregs'.format(func)] = m.group('vregs')
200197

201198

202199
def add_checks_for_function(test, output_lines, run_list, func_dict, func_name,
203-
add_vreg_checks, single_bb, verbose=False):
200+
single_bb, verbose=False):
204201
printed_prefixes = set()
205202
for run in run_list:
206203
for prefix in run.prefixes:
@@ -213,17 +210,14 @@ def add_checks_for_function(test, output_lines, run_list, func_dict, func_name,
213210
# output_lines.append('')
214211
printed_prefixes.add(prefix)
215212
log('Adding {} lines for {}'.format(prefix, func_name), verbose)
216-
vregs = None
217-
if add_vreg_checks:
218-
vregs = func_dict[prefix]['{}:vregs'.format(func_name)]
219213
add_check_lines(test, output_lines, prefix, func_name, single_bb,
220-
func_dict[prefix][func_name].splitlines(), vregs)
214+
func_dict[prefix][func_name].splitlines())
221215
break
222216
return output_lines
223217

224218

225219
def add_check_lines(test, output_lines, prefix, func_name, single_bb,
226-
func_body, vreg_data):
220+
func_body):
227221
if single_bb:
228222
# Don't bother checking the basic block label for a single BB
229223
func_body.pop(0)
@@ -240,12 +234,6 @@ def add_check_lines(test, output_lines, prefix, func_name, single_bb,
240234

241235
output_lines.append('{}-LABEL: name: {}'.format(check, func_name))
242236

243-
if vreg_data:
244-
output_lines.append('{}: registers:'.format(check))
245-
for m in VREG_CLASS_RE.finditer(vreg_data):
246-
output_lines.append('{}-NEXT: id: {}, class: {}'.format(
247-
check, m.group(1), m.group(2)))
248-
249237
vreg_map = {}
250238
for func_line in func_body:
251239
if not func_line.strip():
@@ -304,8 +292,7 @@ def should_add_line_to_output(input_line, prefix_set):
304292
return True
305293

306294

307-
def update_test_file(llc, test, remove_common_prefixes=False,
308-
add_vreg_checks=False, verbose=False):
295+
def update_test_file(llc, test, remove_common_prefixes=False, verbose=False):
309296
log('Scanning for RUN lines in test file: {}'.format(test), verbose)
310297
with open(test) as fd:
311298
input_lines = [l.rstrip() for l in fd]
@@ -384,15 +371,15 @@ def update_test_file(llc, test, remove_common_prefixes=False,
384371
continue
385372
state = 'mir function body'
386373
add_checks_for_function(test, output_lines, run_list,
387-
func_dict, func_name, add_vreg_checks,
388-
single_bb=False, verbose=verbose)
374+
func_dict, func_name, single_bb=False,
375+
verbose=verbose)
389376
elif state == 'mir function prefix':
390377
m = MIR_PREFIX_DATA_RE.match(input_line)
391378
if not m:
392379
state = 'mir function body'
393380
add_checks_for_function(test, output_lines, run_list,
394-
func_dict, func_name, add_vreg_checks,
395-
single_bb=True, verbose=verbose)
381+
func_dict, func_name, single_bb=True,
382+
verbose=verbose)
396383

397384
if should_add_line_to_output(input_line, prefix_set):
398385
output_lines.append(input_line)
@@ -436,15 +423,13 @@ def main():
436423
parser.add_argument('--remove-common-prefixes', action='store_true',
437424
help='Remove existing check lines whose prefixes are '
438425
'shared between multiple commands')
439-
parser.add_argument('--add-vreg-checks', action='store_true',
440-
help='Add checks for the "registers:" block')
441426
parser.add_argument('tests', nargs='+')
442427
args = parser.parse_args()
443428

444429
for test in args.tests:
445430
try:
446431
update_test_file(args.llc, test, args.remove_common_prefixes,
447-
args.add_vreg_checks, verbose=args.verbose)
432+
verbose=args.verbose)
448433
except Exception:
449434
warn('Error processing file', test_file=test)
450435
raise

0 commit comments

Comments
 (0)