[Bug tree-optimization/107833] [12 Regression] wrong code at -Os and above on x86_64-linux-gnu since r12-5138-ge82c382971664d6f
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Dec 12 11:20:59 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107833
--- Comment #16 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:812847a9d12c0b65695cbe1a23959b69a7e62355
commit r12-8977-g812847a9d12c0b65695cbe1a23959b69a7e62355
Author: Richard Biener <rguenther@suse.de>
Date: Fri Dec 2 14:52:20 2022 +0100
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.
(cherry picked from commit 44c8402d35160515b3c09fd2bc239587e0c32a2b)
More information about the Gcc-bugs
mailing list