tree-optimization/112766 - improve pruning of uninit diagnostics
commit8a6062a47b33da6d961c6354fd5788bc46aef0a9
authorRichard Biener <rguenther@suse.de>
Thu, 30 Nov 2023 09:58:13 +0000 (30 10:58 +0100)
committerRichard Biener <rguenther@suse.de>
Thu, 30 Nov 2023 12:31:25 +0000 (30 13:31 +0100)
tree72cb3f46ddf93a333e947d45d0d03b8eed68a41c
parent303195e2a6b6f0e8f42e0578b61f9f37c6250beb
tree-optimization/112766 - improve pruning of uninit diagnostics

Uninit diagnostics has code to prune based on incoming PHI args
that prove the uninit code is never executed.  But that only
looks at the first found flag candidate while in the PRs case
only the second candidate would be the one to prune on.  The
following patch makes us consider all of the flag candidates
which is cycles well spent IMHO.

PR tree-optimization/112766
* gimple-predicate-analysis.cc (find_var_cmp_const):
Support continuing the iteration and report every candidate.
(uninit_analysis::overlap): Iterate over all flag var
candidates.

* g++.dg/torture/uninit-pr112766.C: New testcase.
gcc/gimple-predicate-analysis.cc
gcc/testsuite/g++.dg/torture/uninit-pr112766.C [new file with mode: 0644]