[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
Mon Jul 26 00:57:19 PDT 2021


qiucf updated this revision to Diff 361587.
qiucf marked 6 inline comments as done.
qiucf added a comment.

Address some comments.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97106/new/

https://reviews.llvm.org/D97106

Files:
  llvm/test/tools/UpdateTestChecks/update_llc_test_checks/prefix-never-matches.test
  llvm/test/tools/UpdateTestChecks/update_test_checks/prefix-never-matches.test
  llvm/utils/UpdateTestChecks/common.py


Index: llvm/utils/UpdateTestChecks/common.py
===================================================================
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -315,8 +315,9 @@
         self._global_var_dict.update({prefix:dict()})
 
   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 in test %s' % (prefix,self._path,))
+    for prefix, funcs in self._get_failed_prefixes_with_functions():
+      warn('prefix %s had conflicting output from different RUN lines for functions: %s' % (
+          prefix, ', '.join(funcs)))
     return self._func_dict
 
   def func_order(self):
@@ -407,17 +408,17 @@
             scrubbed_body, scrubbed_extra, args_and_sig, attrs)
         self._func_order[prefix].append(func)
 
-  def _get_failed_prefixes(self):
-    # This returns the list of those prefixes that failed to match any function,
-    # 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.
+  def _get_failed_prefixes_with_functions(self):
+    # This returns the list of prefixes that failed to match some functions,
+    # along with function names, because there were conflicting bodies produced
+    # by different RUN lines, in all instrances 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-never-matches.test
===================================================================
--- llvm/test/tools/UpdateTestChecks/update_test_checks/prefix-never-matches.test
+++ llvm/test/tools/UpdateTestChecks/update_test_checks/prefix-never-matches.test
@@ -2,5 +2,5 @@
 # RUN: %update_test_checks %t.ll 2>&1 | FileCheck %s
 # RUN: FileCheck --input-file=%t.ll %s --check-prefix=OUTPUT
 
-# CHECK: WARNING: Prefix A had conflicting output
-# OUTPUT-NOT: A:
\ No newline at end of file
+# CHECK: WARNING: prefix A had conflicting output
+# OUTPUT-NOT: A:
Index: llvm/test/tools/UpdateTestChecks/update_llc_test_checks/prefix-never-matches.test
===================================================================
--- llvm/test/tools/UpdateTestChecks/update_llc_test_checks/prefix-never-matches.test
+++ llvm/test/tools/UpdateTestChecks/update_llc_test_checks/prefix-never-matches.test
@@ -4,5 +4,5 @@
 # RUN: %update_llc_test_checks %t.ll 2>&1 | FileCheck %s
 # RUN: FileCheck --input-file=%t.ll %s --check-prefix=OUTPUT
 
-# CHECK: WARNING: Prefix A had conflicting output
-# OUTPUT-NOT: A:
\ No newline at end of file
+# CHECK: WARNING: prefix A had conflicting output
+# OUTPUT-NOT: A:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97106.361587.patch
Type: text/x-patch
Size: 3217 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210726/8da7a320/attachment.bin>


More information about the llvm-commits mailing list