[PATCH] D95794: [WIP][Utils] Fix conflicting checkline generation.
Kuter Dinel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 1 09:39:15 PST 2021
kuter created this revision.
Herald added a subscriber: arichardson.
kuter requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Example:
We have 3 run lines.
; RUN: opt ..... | FileChek --check-prefixes=A,D
; RUN: opt ..... | FileChek --check-prefixes=B,C
; RUN: opt ..... | FileChek --check-prefixes=A,B
For a function, three run lines generates the same output
but this is just a coincidence so check lines are correct.
Before this patch generated output is.
; A-LABEL: define .....
; A ......
; B-LABEL: define .....
; B ......
The third line is going to fail since it can't match the "B-LABEL"
check since the "A-LABEL" line have consumed the function signature
This patch corrects this issue by excluding all checkprefixes
that exist in the same run line as the choosen prefix.
For "-LABEL" generation this is shouldn't affect existing checks.
There is no way that tests that are affected by this change are
valid.
[WIP] Are other users of common.py effected by this change ?
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D95794
Files:
llvm/utils/UpdateTestChecks/common.py
Index: llvm/utils/UpdateTestChecks/common.py
===================================================================
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -479,6 +479,9 @@
# prefix_exclusions are prefixes we cannot use to print the function because it doesn't exist in run lines that use these prefixes as well.
prefix_exclusions = set()
printed_prefixes = []
+ # A mapping of prefixes to the run lines they exist in.
+ prefix_to_lines = {}
+
for p in prefix_list:
checkprefixes = p[0]
# If not all checkprefixes of this run line produced the function we cannot check for it as it does not
@@ -487,6 +490,11 @@
if any(map(lambda checkprefix: func_name not in func_dict[checkprefix], checkprefixes)):
prefix_exclusions |= set(checkprefixes)
continue
+ for prefix in checkprefixes:
+ if prefix not in prefix_to_lines:
+ prefix_to_lines[prefix] = []
+ prefix_to_lines[prefix].append(p)
+
# prefix_exclusions is constructed, we can now emit the output
for p in prefix_list:
@@ -515,6 +523,9 @@
vars_seen = set()
printed_prefixes.append(checkprefix)
+ # For this function we can't use any of the other prefixes that exists in the run lines
+ # that this prefix is in.
+ prefix_exclusions |= { prefix for prefix in p[0] for p in prefix_to_lines[prefix] }
attrs = str(func_dict[checkprefix][func_name].attrs)
attrs = '' if attrs == 'None' else attrs
if attrs:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95794.320503.patch
Type: text/x-patch
Size: 1533 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210201/4ba3ac89/attachment.bin>
More information about the llvm-commits
mailing list