Skip to content

Commit ba1dbdd

Browse files
authored
Revert "[utils][UpdateLLCTestChecks] Add MIR support to update_llc_test_checks.py." (#166549)
Reverts #164965
1 parent 305cf62 commit ba1dbdd

File tree

9 files changed

+19
-194
lines changed

9 files changed

+19
-194
lines changed

llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/x86_asm_mir_mixed.ll

Lines changed: 0 additions & 17 deletions
This file was deleted.

llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/x86_asm_mir_mixed.ll.expected

Lines changed: 0 additions & 45 deletions
This file was deleted.

llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/x86_asm_mir_same_prefix.ll

Lines changed: 0 additions & 13 deletions
This file was deleted.

llvm/test/tools/UpdateTestChecks/update_llc_test_checks/Inputs/x86_asm_mir_same_prefix.ll.expected

Lines changed: 0 additions & 16 deletions
This file was deleted.

llvm/test/tools/UpdateTestChecks/update_llc_test_checks/x86-asm-mir-mixed.test

Lines changed: 0 additions & 9 deletions
This file was deleted.

llvm/test/tools/UpdateTestChecks/update_llc_test_checks/x86-asm-mir-same-prefix.test

Lines changed: 0 additions & 7 deletions
This file was deleted.

llvm/utils/UpdateTestChecks/common.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,6 @@ def invoke_tool(exe, cmd_args, ir, preprocess_cmd=None, verbose=False):
605605
TRIPLE_ARG_RE = re.compile(r"-m?triple[= ]([^ ]+)")
606606
MARCH_ARG_RE = re.compile(r"-march[= ]([^ ]+)")
607607
DEBUG_ONLY_ARG_RE = re.compile(r"-debug-only[= ]([^ ]+)")
608-
STOP_PASS_RE = re.compile(r"-stop-(before|after)=(\w+)")
609608

610609
IS_DEBUG_RECORD_RE = re.compile(r"^(\s+)#dbg_")
611610
IS_SWITCH_CASE_RE = re.compile(r"^\s+i\d+ \d+, label %\S+")

llvm/utils/UpdateTestChecks/mir.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,13 @@ def add_mir_checks_for_function(
163163
print_fixed_stack,
164164
first_check_is_next,
165165
at_the_function_name,
166-
check_indent=None,
167166
):
168167
printed_prefixes = set()
169168
for run in run_list:
170169
for prefix in run[0]:
171170
if prefix in printed_prefixes:
172171
break
173-
# func_info can be empty if there was a prefix conflict.
174-
if not func_dict[prefix].get(func_name):
172+
if not func_dict[prefix][func_name]:
175173
continue
176174
if printed_prefixes:
177175
# Add some space between different check prefixes.
@@ -187,7 +185,6 @@ def add_mir_checks_for_function(
187185
func_dict[prefix][func_name],
188186
print_fixed_stack,
189187
first_check_is_next,
190-
check_indent,
191188
)
192189
break
193190
else:
@@ -207,7 +204,6 @@ def add_mir_check_lines(
207204
func_info,
208205
print_fixed_stack,
209206
first_check_is_next,
210-
check_indent=None,
211207
):
212208
func_body = str(func_info).splitlines()
213209
if single_bb:
@@ -224,10 +220,7 @@ def add_mir_check_lines(
224220
first_line = func_body[0]
225221
indent = len(first_line) - len(first_line.lstrip(" "))
226222
# A check comment, indented the appropriate amount
227-
if check_indent is not None:
228-
check = "{}; {}".format(check_indent, prefix)
229-
else:
230-
check = "{:>{}}; {}".format("", indent, prefix)
223+
check = "{:>{}}; {}".format("", indent, prefix)
231224

232225
output_lines.append("{}-LABEL: name: {}".format(check, func_name))
233226

llvm/utils/update_llc_test_checks.py

Lines changed: 17 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import os # Used to advertise this file's name ("autogenerated_note").
1616
import sys
1717

18-
from UpdateTestChecks import common, mir
18+
from UpdateTestChecks import common
1919

2020
# llc is the only llc-like in the LLVM tree but downstream forks can add
2121
# additional ones here if they have them.
@@ -33,7 +33,6 @@ def update_test(ti: common.TestInfo):
3333
break
3434

3535
run_list = []
36-
mir_run_list = []
3736
for l in ti.run_lines:
3837
if "|" not in l:
3938
common.warn("Skipping unparsable RUN line: " + l)
@@ -58,14 +57,9 @@ def update_test(ti: common.TestInfo):
5857
if m:
5958
march_in_cmd = m.groups()[0]
6059

61-
target_list = run_list
6260
m = common.DEBUG_ONLY_ARG_RE.search(llc_cmd)
6361
if m and m.groups()[0] == "isel":
6462
from UpdateTestChecks import isel as output_type
65-
elif not m and common.STOP_PASS_RE.search(llc_cmd):
66-
# MIR output mode. If -debug-only is present assume
67-
# the debug output is the main point of interest.
68-
target_list = mir_run_list
6963
else:
7064
from UpdateTestChecks import asm as output_type
7165

@@ -90,7 +84,7 @@ def update_test(ti: common.TestInfo):
9084

9185
# FIXME: We should use multiple check prefixes to common check lines. For
9286
# now, we just ignore all but the last.
93-
target_list.append(
87+
run_list.append(
9488
(
9589
check_prefixes,
9690
llc_tool,
@@ -125,20 +119,14 @@ def update_test(ti: common.TestInfo):
125119
ginfo=ginfo,
126120
)
127121

128-
# Dictionary to store MIR function bodies separately
129-
mir_func_dict = {}
130-
for run_tuple, is_mir in [(run, False) for run in run_list] + [
131-
(run, True) for run in mir_run_list
132-
]:
133-
(
134-
prefixes,
135-
llc_tool,
136-
llc_args,
137-
preprocess_cmd,
138-
triple_in_cmd,
139-
march_in_cmd,
140-
) = run_tuple
141-
122+
for (
123+
prefixes,
124+
llc_tool,
125+
llc_args,
126+
preprocess_cmd,
127+
triple_in_cmd,
128+
march_in_cmd,
129+
) in run_list:
142130
common.debug("Extracted LLC cmd:", llc_tool, llc_args)
143131
common.debug("Extracted FileCheck prefixes:", str(prefixes))
144132

@@ -153,54 +141,22 @@ def update_test(ti: common.TestInfo):
153141
if not triple:
154142
triple = common.get_triple_from_march(march_in_cmd)
155143

156-
if is_mir:
157-
# MIR output mode
158-
common.debug("Detected MIR output mode for prefixes:", str(prefixes))
159-
for prefix in prefixes:
160-
if prefix not in mir_func_dict:
161-
mir_func_dict[prefix] = {}
162-
163-
mir.build_function_info_dictionary(
164-
ti.path,
165-
raw_tool_output,
166-
triple,
167-
prefixes,
168-
mir_func_dict,
169-
ti.args.verbose,
144+
scrubber, function_re = output_type.get_run_handler(triple)
145+
if 0 == builder.process_run_line(
146+
function_re, scrubber, raw_tool_output, prefixes
147+
):
148+
common.warn(
149+
"Couldn't match any function. Possibly the wrong target triple has been provided"
170150
)
171-
else:
172-
# ASM output mode
173-
scrubber, function_re = output_type.get_run_handler(triple)
174-
if 0 == builder.process_run_line(
175-
function_re, scrubber, raw_tool_output, prefixes
176-
):
177-
common.warn(
178-
"Couldn't match any function. Possibly the wrong target triple has been provided"
179-
)
180-
builder.processed_prefixes(prefixes)
151+
builder.processed_prefixes(prefixes)
181152

182153
func_dict = builder.finish_and_get_func_dict()
183-
184-
# Check for conflicts: same prefix used for both ASM and MIR
185-
conflicting_prefixes = set(func_dict.keys()) & set(mir_func_dict.keys())
186-
if conflicting_prefixes:
187-
common.warn(
188-
"The following prefixes are used for both ASM and MIR output, which will cause FileCheck failures: {}".format(
189-
", ".join(sorted(conflicting_prefixes))
190-
),
191-
test_file=ti.path,
192-
)
193-
for prefix in conflicting_prefixes:
194-
mir_func_dict[prefix] = {}
195-
func_dict[prefix] = {}
196-
197154
global_vars_seen_dict = {}
198155

199156
is_in_function = False
200157
is_in_function_start = False
201158
func_name = None
202159
prefix_set = set([prefix for p in run_list for prefix in p[0]])
203-
prefix_set.update([prefix for p in mir_run_list for prefix in p[0]])
204160
common.debug("Rewriting FileCheck prefixes:", str(prefix_set))
205161
output_lines = []
206162

@@ -265,22 +221,6 @@ def update_test(ti: common.TestInfo):
265221
is_filtered=builder.is_filtered(),
266222
)
267223
)
268-
269-
# Also add MIR checks if we have them for this function
270-
if mir_run_list and func_name:
271-
mir.add_mir_checks_for_function(
272-
ti.path,
273-
output_lines,
274-
mir_run_list,
275-
mir_func_dict,
276-
func_name,
277-
single_bb=False, # Don't skip basic block labels.
278-
print_fixed_stack=False, # Don't print fixed stack (ASM tests don't need it).
279-
first_check_is_next=False, # First check is LABEL, not NEXT.
280-
at_the_function_name=False, # Use "name:" not "@name".
281-
check_indent="", # No indentation for IR files (not MIR files).
282-
)
283-
284224
is_in_function_start = False
285225

286226
if is_in_function:

0 commit comments

Comments
 (0)