[PATCH] D95829: [Utils] Add a switch controlling prefix warnings in UpdateTestChecks

Mircea Trofin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 1 17:59:57 PST 2021


mtrofin updated this revision to Diff 320650.
mtrofin marked an inline comment as done.
mtrofin added a comment.

added test


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95829

Files:
  llvm/test/tools/UpdateTestChecks/update_llc_test_checks/common-label-different-bodies.test
  llvm/utils/UpdateTestChecks/common.py


Index: llvm/utils/UpdateTestChecks/common.py
===================================================================
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -30,9 +30,14 @@
                        help='Activate CHECK line generation from this point forward')
   parser.add_argument('--disable', action='store_false', dest='enabled',
                       help='Deactivate CHECK line generation from this point forward')
+  parser.add_argument('--disable-verbose-prefix-warnings', action='store_false', 
+                      default=True,
+                      dest='verbose_prefix_warnings',
+                      help='Disable warnings about unused prefixes.')
   args = parser.parse_args()
-  global _verbose
+  global _verbose, _verbose_prefix_warnings
   _verbose = args.verbose
+  _verbose_prefix_warnings = args.verbose_prefix_warnings
   return args
 
 
@@ -272,8 +277,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,))
+    if _verbose_prefix_warnings:
+      for prefix in self._get_failed_prefixes():
+        warn('Prefix %s had conflicting output from different RUN lines for all functions' % (prefix,))
     return self._func_dict
 
   def func_order(self):
@@ -329,6 +335,9 @@
               # so the body can't be common accross RUN lines. We use None to
               # indicate that.
               self._func_dict[prefix][func] = None
+              if _verbose_prefix_warnings:
+                warn('Function %s had conflicting output from different RUN lines for prefix %s' % (
+                    func, prefix))
               continue
 
         self._func_dict[prefix][func] = function_body(
Index: llvm/test/tools/UpdateTestChecks/update_llc_test_checks/common-label-different-bodies.test
===================================================================
--- llvm/test/tools/UpdateTestChecks/update_llc_test_checks/common-label-different-bodies.test
+++ llvm/test/tools/UpdateTestChecks/update_llc_test_checks/common-label-different-bodies.test
@@ -3,7 +3,7 @@
 # RUN: cp -f %S/Inputs/common-label-different-bodies-1.ll %t-1.ll
 # RUN: cp -f %S/Inputs/common-label-different-bodies-2.ll %t-2.ll
 # RUN: cp -f %S/Inputs/common-label-different-bodies-3.ll %t-3.ll
-# RUN: %update_llc_test_checks %t-1.ll
+# RUN: %update_llc_test_checks %t-1.ll 2>&1 | FileCheck %s --check-prefix=WARNINGS
 # RUN: %update_llc_test_checks %t-2.ll
 # RUN: %update_llc_test_checks %t-3.ll
 # RUN: FileCheck --input-file=%t-1.ll %s
@@ -11,4 +11,6 @@
 # RUN: FileCheck --input-file=%t-3.ll %s
 
 # CHECK: B-LABEL: fold_v2i64
-# CHECK-NOT: A-LABEL: fold_v2i64
\ No newline at end of file
+# CHECK-NOT: A-LABEL: fold_v2i64
+# WARNINGS: WARNING: Function fold_v2i64 had conflicting output from different RUN lines for prefix A
+# WARNINGS: WARNING: Prefix A had conflicting output from different RUN lines for all functions
\ No newline at end of file


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95829.320650.patch
Type: text/x-patch
Size: 3095 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210202/36c9c5b7/attachment.bin>


More information about the llvm-commits mailing list