https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56654
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:8a63343a744a8584a9dfcbc3817f66755baafe8a commit r13-2261-g8a63343a744a8584a9dfcbc3817f66755baafe8a Author: Richard Biener <rguent...@suse.de> Date: Mon Aug 29 16:16:44 2022 +0200 tree-optimization/56654 - sort uninit candidates after RPO The following sorts the immediate uses of a possibly uninitialized SSA variable after their RPO order so we prefer warning for an earlier occuring use rather than issueing the diagnostic for the first uninitialized immediate use. The sorting will inevitably be imperfect but it also allows us to optimize the expensive predicate check for the case where there are multiple uses in the same basic-block which is a nice side-effect. PR tree-optimization/56654 * tree-ssa-uninit.cc (cand_cmp): New. (find_uninit_use): First process all PHIs and collect candidate stmts, then sort those after RPO. (warn_uninitialized_phi): Pass on bb_to_rpo. (execute_late_warn_uninitialized): Compute and pass on reverse lookup of RPO number from basic block index.