]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/56654 - sort uninit candidates after RPO
authorRichard Biener <rguenther@suse.de>
Mon, 29 Aug 2022 14:16:44 +0000 (16:16 +0200)
committerRichard Biener <rguenther@suse.de>
Tue, 30 Aug 2022 07:32:01 +0000 (09:32 +0200)
commit8a63343a744a8584a9dfcbc3817f66755baafe8a
treededb67cd8b101462d9c4c148b3b5e1cfcaf46cd4
parent4a8f98fa3bef754abedc3ed7a1839b4c8c782730
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.
gcc/tree-ssa-uninit.cc