diff --git a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/prefix-never-matches.test b/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/prefix-never-matches.test --- a/llvm/test/tools/UpdateTestChecks/update_llc_test_checks/prefix-never-matches.test +++ b/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: 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,21 @@ +; RUN: opt < %s -instcombine -S | FileCheck %s +; RUN: opt < %s -vectorize-slp -S | FileCheck %s + +define i32 @diff1(i32 %X, i32 %Y) { + %Z = sub i32 %X, %Y + %Q = add i32 %Z, %Y + ret i32 %Q +} + +define <2 x i32> @diff2(<2 x i32> %X) { + %A = and <2 x i32> %X, + %B = lshr <2 x i32> %A, + %C = icmp eq <2 x i32> %B, zeroinitializer + %D = zext <2 x i1> %C to <2 x i32> + ret <2 x i32> %D +} + +define <4 x float> @same(<4 x float> %X, <4 x float> %Y) { + %A = shufflevector <4 x float> %X, <4 x float> %Y, <4 x i32> + ret <4 x float> %A +} diff --git a/llvm/test/tools/UpdateTestChecks/update_test_checks/prefix-never-matches.test b/llvm/test/tools/UpdateTestChecks/update_test_checks/prefix-never-matches.test --- a/llvm/test/tools/UpdateTestChecks/update_test_checks/prefix-never-matches.test +++ b/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: 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 %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: diff1, diff2 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 @@ -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