diff options
author | Richard Biener <rguenther@suse.de> | 2022-12-02 14:52:20 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2022-12-05 10:22:53 +0100 |
commit | 44c8402d35160515b3c09fd2bc239587e0c32a2b (patch) | |
tree | f592f253098750358187f2ee53bce15c1b97b175 /gcc/cfghooks.cc | |
parent | 824542bec24c09319fa55922a0162209a5f64963 (diff) | |
download | gcc-44c8402d35160515b3c09fd2bc239587e0c32a2b.zip gcc-44c8402d35160515b3c09fd2bc239587e0c32a2b.tar.gz gcc-44c8402d35160515b3c09fd2bc239587e0c32a2b.tar.bz2 |
tree-optimization/107833 - invariant motion of uninit uses
The following fixes a wrong-code bug caused by loop invariant motion
hoisting an expression using an uninitialized value outside of its
controlling condition causing IVOPTs to use that to rewrite a defined
value. PR107839 is a similar case involving a bogus uninit diagnostic.
PR tree-optimization/107833
PR tree-optimization/107839
* cfghooks.cc: Include tree.h.
* tree-ssa-loop-im.cc (movement_possibility): Wrap and
make stmts using any ssa_name_maybe_undef_p operand
to preserve execution.
(loop_invariant_motion_in_fun): Call mark_ssa_maybe_undefs
to init maybe-undefined status.
* tree-ssa-loop-ivopts.cc (ssa_name_maybe_undef_p,
ssa_name_set_maybe_undef, ssa_name_any_use_dominates_bb_p,
mark_ssa_maybe_undefs): Move ...
* tree-ssa.cc: ... here.
* tree-ssa.h (ssa_name_any_use_dominates_bb_p,
mark_ssa_maybe_undefs): Declare.
(ssa_name_maybe_undef_p, ssa_name_set_maybe_undef): Define.
* gcc.dg/torture/pr107833.c: New testcase.
* gcc.dg/uninit-pr107839.c: Likewise.
Diffstat (limited to 'gcc/cfghooks.cc')
-rw-r--r-- | gcc/cfghooks.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/cfghooks.cc b/gcc/cfghooks.cc index 29ded57..f8fa13c 100644 --- a/gcc/cfghooks.cc +++ b/gcc/cfghooks.cc @@ -29,6 +29,7 @@ along with GCC; see the file COPYING3. If not see #include "diagnostic-core.h" #include "dumpfile.h" #include "cfganal.h" +#include "tree.h" #include "tree-ssa.h" #include "cfgloop.h" #include "sreal.h" |