[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 15:24:29 PST 2021


mtrofin created this revision.
mtrofin added reviewers: craig.topper, jdoerfert.
Herald added a subscriber: arichardson.
mtrofin requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The switch controls both unused prefix warnings, and warnings about
functions which differ under different runs for a prefix, and, thus, end
up not having asserts for that prefix.

(If the latter case spans to all functions, then the former case kicks
in)

The switch is on by default, and can be disabled.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95829

Files:
  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
 
 
@@ -266,14 +271,16 @@
     self._scrubber_args = scrubber_args
     self._func_dict = {}
     self._func_order = {}
+    self._flags = flags
     for tuple in run_list:
       for prefix in tuple[0]:
         self._func_dict.update({prefix:dict()})
         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 +336,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(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95829.320623.patch
Type: text/x-patch
Size: 2089 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210201/ca821a55/attachment.bin>


More information about the llvm-commits mailing list