tree-optimization/104373 - early diagnostic on unreachable code
authorRichard Biener <rguenther@suse.de>
Fri, 4 Feb 2022 08:46:43 +0000 (09:46 +0100)
committerRichard Biener <rguenther@suse.de>
Thu, 10 Feb 2022 09:56:14 +0000 (10:56 +0100)
commit0f58ba4dd6b25b16d25494ae18d15dfa681f9b65
tree72fb407291d3a50d206b43c977c237a49a41e642
parent4a8083285c3edf50088a095870b217ab0881dff0
tree-optimization/104373 - early diagnostic on unreachable code

The following improves early uninit diagnostics by computing edge
reachability using VN and ignoring unreachable blocks when looking
for uninitialized uses.  To not ICE with -fdump-tree-all the
early uninit pass needs a dumpfile since VN tries to dump statistics.

2022-02-04  Richard Biener  <rguenther@suse.de>

PR tree-optimization/104373
* tree-ssa-sccvn.h (do_rpo_vn): New export exposing the
walk kind.
* tree-ssa-sccvn.cc (do_rpo_vn): Export, get the default
walk kind as argument.
(run_rpo_vn): Adjust.
(pass_fre::execute): Likewise.
* tree-ssa-uninit.cc (warn_uninitialized_vars): Skip
blocks not reachable.
(execute_late_warn_uninitialized): Mark all edges as
executable.
(execute_early_warn_uninitialized): Use VN to compute
executable edges.
(pass_data_early_warn_uninitialized): Enable a dump file,
change dump name to warn_uninit.

* g++.dg/warn/Wuninitialized-32.C: New testcase.
* gcc.dg/uninit-pr20644-O0.c: Remove XFAIL.
gcc/testsuite/g++.dg/warn/Wuninitialized-32.C [new file with mode: 0644]
gcc/testsuite/gcc.dg/uninit-pr20644-O0.c
gcc/tree-ssa-sccvn.cc
gcc/tree-ssa-sccvn.h
gcc/tree-ssa-uninit.cc