[llvm] [UpdateTestChecks] Don't fail silently when conflicting CHECK lines means no checks are generated for some functions (PR #159321)
Alexander Richardson via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 22 10:53:52 PDT 2025
================
@@ -917,15 +918,49 @@ def __init__(self, run_list, flags, scrubber_args, path, ginfo):
self._func_order.update({prefix: []})
self._global_var_dict.update({prefix: dict()})
+ # Return true if there is conflicting output for different runs for the
+ # given prefix and function name.
+ def has_conflicting_output(self, prefix, func):
+ # There was conflicting output if the func_dict is None for this
+ # prefix and function.
+ return self._func_dict[prefix].get(func) is None
+
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,
+ all_funcs = set()
+ for prefix in self._func_dict:
+ all_funcs.update(self._func_dict[prefix].keys())
+
+ warnings_to_print = collections.defaultdict(list)
+ for func in sorted(list(all_funcs)):
+ for i, run_info in enumerate(self._run_list):
+ prefixes = run_info[0]
+ if not prefixes:
+ continue
+
+ # Check if this RUN line produces this function at all. If
+ # not, we can skip analysing this function for this RUN.
+ run_contains_func = all(func in self._func_dict.get(p, {}) for p in prefixes)
+ if not run_contains_func:
+ continue
+
+ # Check if this RUN line can print any checks for this
+ # function. It can't if all of its prefixes have conflicting
+ # (None) output.
+ can_print_for_this_run = not all(self.has_conflicting_output(p, func) for p in prefixes)
+ if not can_print_for_this_run:
----------------
arichardson wrote:
```suggestion
cannot_print_for_this_run = all(self.has_conflicting_output(p, func) for p in prefixes)
if cannot_print_for_this_run:
```
Maybe this to avoid the double not?
https://github.com/llvm/llvm-project/pull/159321
More information about the llvm-commits
mailing list