diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/conflict.ll b/llvm/test/tools/UpdateTestChecks/update_test_checks/Inputs/conflict.ll new file mode 100644 --- /dev/null +++ b/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 +} diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/prefix_conflicts.test b/llvm/test/tools/UpdateTestChecks/update_test_checks/prefix_conflicts.test new file mode 100644 --- /dev/null +++ b/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 diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py --- a/llvm/utils/UpdateTestChecks/common.py +++ b/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