[PATCH] D97106: [UpdateTestChecks] Warn if any function conflicts under the same prefix
Qiu Chaofan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 19 19:23:07 PST 2021
qiucf created this revision.
qiucf added reviewers: MaskRay, mtrofin, sstefan1, greened, pengfei.
Herald added a subscriber: arichardson.
qiucf requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Currently the update test script will only output warning if **all functions** have conflict under different run lines with same prefix, and be silent if part of them conflict. This looks counterintuitive and leads to confusion sometimes.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D97106
Files:
llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/conflict.ll
llvm/test/tools/UpdateTestChecks/update_test_checks/prefix_conflicts.test
llvm/utils/UpdateTestChecks/common.py
Index: llvm/utils/UpdateTestChecks/common.py
===================================================================
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -272,8 +272,9 @@
self._func_order.update({prefix: []})
def finish_and_get_func_dict(self):
- for prefix in self._get_failed_prefixes():
- warn('Prefix %s had conflicting output from different RUN lines for all functions' % (prefix,))
+ for prefix, funcs in self._get_failed_prefixes():
+ warn('Prefix %s had conflicting output from different RUN lines for functions: %s' % (
+ prefix, ', '.join(funcs)))
return self._func_dict
def func_order(self):
@@ -336,15 +337,15 @@
self._func_order[prefix].append(func)
def _get_failed_prefixes(self):
- # This returns the list of those prefixes that failed to match any function,
+ # This returns the list of those prefixes that failed to match some functions,
# because there were conflicting bodies produced by different RUN lines, in
- # all instances of the prefix. Effectively, this prefix is unused and should
- # be removed.
+ # all instances of the prefix. This prefix needs to be split or removed.
for prefix in self._func_dict:
- if (self._func_dict[prefix] and
- (not [fct for fct in self._func_dict[prefix]
- if self._func_dict[prefix][fct] is not None])):
- yield prefix
+ if self._func_dict[prefix]:
+ funcs = [fct for fct in self._func_dict[prefix]
+ if self._func_dict[prefix][fct] is None]
+ if funcs:
+ yield (prefix, funcs)
##### Generator of LLVM IR CHECK lines
Index: llvm/test/tools/UpdateTestChecks/update_test_checks/prefix_conflicts.test
===================================================================
--- /dev/null
+++ llvm/test/tools/UpdateTestChecks/update_test_checks/prefix_conflicts.test
@@ -0,0 +1,4 @@
+# Verify the script warns about conflicts of prefix in multiple run lines
+# RUN: cp -f %S/Inputs/conflict.ll %t.ll
+# RUN: %update_test_checks %t.ll 2>&1 | FileCheck %s
+# CHECK: Prefix CHECK had conflicting output from different RUN lines for functions: example
Index: llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/conflict.ll
===================================================================
--- /dev/null
+++ llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/conflict.ll
@@ -0,0 +1,8 @@
+; RUN: opt < %s -instcombine -S | FileCheck %s
+; RUN: opt < %s -vectorize-slp -S | FileCheck %s
+
+define i32 @example(i32 %X, i32 %Y) {
+ %Z = sub i32 %X, %Y
+ %Q = add i32 %Z, %Y
+ ret i32 %Q
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97106.325141.patch
Type: text/x-patch
Size: 2673 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210220/8d0a54f9/attachment.bin>
More information about the llvm-commits
mailing list