[PATCH] D101312: [Utils] Do not remove comments in llc test script
Sebastian Neubauer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 26 11:03:45 PDT 2021
sebastian-ne created this revision.
sebastian-ne added reviewers: jdoerfert, ggeorgakoudis, foad.
Herald added a subscriber: arichardson.
sebastian-ne requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
When checking if two prefixes can be merged for a function,
update_llc_test_checks.py removed IR comments before comparing
llc outputs of different RUN lines.
This means, if one RUN line emited lines starting with ';' and another
RUN line emited the same lines except the ones starting with ';', both
RUNs would be merged (if they share a prefix).
However, CHECK-NEXT lines check the comments, otherwise they fail, so
the script should not merge RUNs if they contain different comments.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D101312
Files:
llvm/utils/UpdateTestChecks/common.py
llvm/utils/update_analyze_test_checks.py
llvm/utils/update_cc_test_checks.py
llvm/utils/update_llc_test_checks.py
llvm/utils/update_test_checks.py
Index: llvm/utils/update_test_checks.py
===================================================================
--- llvm/utils/update_test_checks.py
+++ llvm/utils/update_test_checks.py
@@ -116,7 +116,7 @@
raw_tool_output = common.invoke_tool(ti.args.opt_binary, opt_args,
ti.path)
builder.process_run_line(common.OPT_FUNCTION_RE, common.scrub_body,
- raw_tool_output, prefixes)
+ raw_tool_output, prefixes, False)
func_dict = builder.finish_and_get_func_dict()
is_in_function = False
Index: llvm/utils/update_llc_test_checks.py
===================================================================
--- llvm/utils/update_llc_test_checks.py
+++ llvm/utils/update_llc_test_checks.py
@@ -124,7 +124,7 @@
triple = asm.get_triple_from_march(march_in_cmd)
scrubber, function_re = asm.get_run_handler(triple)
- builder.process_run_line(function_re, scrubber, raw_tool_output, prefixes)
+ builder.process_run_line(function_re, scrubber, raw_tool_output, prefixes, True)
func_dict = builder.finish_and_get_func_dict()
Index: llvm/utils/update_cc_test_checks.py
===================================================================
--- llvm/utils/update_cc_test_checks.py
+++ llvm/utils/update_cc_test_checks.py
@@ -197,7 +197,7 @@
if '-emit-llvm' in clang_args:
builder.process_run_line(
common.OPT_FUNCTION_RE, common.scrub_body, raw_tool_output,
- prefixes)
+ prefixes, False)
else:
print('The clang command line should include -emit-llvm as asm tests '
'are discouraged in Clang testsuite.', file=sys.stderr)
Index: llvm/utils/update_analyze_test_checks.py
===================================================================
--- llvm/utils/update_analyze_test_checks.py
+++ llvm/utils/update_analyze_test_checks.py
@@ -126,7 +126,7 @@
# Split analysis outputs by "Printing analysis " declarations.
for raw_tool_output in re.split(r'Printing analysis ', raw_tool_outputs):
builder.process_run_line(common.ANALYZE_FUNCTION_RE, common.scrub_body,
- raw_tool_output, prefixes)
+ raw_tool_output, prefixes, False)
func_dict = builder.finish_and_get_func_dict()
is_in_function = False
Index: llvm/utils/UpdateTestChecks/common.py
===================================================================
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -249,7 +249,7 @@
self.extrascrub = extra
self.args_and_sig = args_and_sig
self.attrs = attrs
- def is_same_except_arg_names(self, extrascrub, args_and_sig, attrs):
+ def is_same_except_arg_names(self, extrascrub, args_and_sig, attrs, is_asm):
arg_names = set()
def drop_arg_names(match):
arg_names.add(match.group(variable_group_in_ir_value_match))
@@ -270,8 +270,9 @@
return False
es0 = IR_VALUE_RE.sub(repl_arg_names, self.extrascrub)
es1 = IR_VALUE_RE.sub(repl_arg_names, extrascrub)
- es0 = SCRUB_IR_COMMENT_RE.sub(r'', es0)
- es1 = SCRUB_IR_COMMENT_RE.sub(r'', es1)
+ if not is_asm:
+ es0 = SCRUB_IR_COMMENT_RE.sub(r'', es0)
+ es1 = SCRUB_IR_COMMENT_RE.sub(r'', es1)
return es0 == es1
def __str__(self):
@@ -305,7 +306,7 @@
def global_var_dict(self):
return self._global_var_dict
- def process_run_line(self, function_re, scrubber, raw_tool_output, prefixes):
+ def process_run_line(self, function_re, scrubber, raw_tool_output, prefixes, is_asm):
build_global_values_dictionary(self._global_var_dict, raw_tool_output, prefixes)
for m in function_re.finditer(raw_tool_output):
if not m:
@@ -346,7 +347,8 @@
self._func_dict[prefix][func].is_same_except_arg_names(
scrubbed_extra,
args_and_sig,
- attrs)):
+ attrs,
+ is_asm)):
self._func_dict[prefix][func].scrub = scrubbed_extra
self._func_dict[prefix][func].args_and_sig = args_and_sig
continue
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101312.340588.patch
Type: text/x-patch
Size: 4167 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210426/5b853b5d/attachment.bin>
More information about the llvm-commits
mailing list