tree-optimization/110228 - avoid undefs in ifcombine more thoroughly
commitb083203f053f1666e9cc1ded2abdf4e1688d1ec0
authorRichard Biener <rguenther@suse.de>
Tue, 4 Jul 2023 08:29:26 +0000 (4 10:29 +0200)
committerRichard Biener <rguenther@suse.de>
Tue, 4 Jul 2023 09:11:45 +0000 (4 11:11 +0200)
treed7ef796b7d23e69b71ec198f8c48c6c52769af83
parent729aa4fa48d627c4344764676edad3b65d40a003
tree-optimization/110228 - avoid undefs in ifcombine more thoroughly

The following replaces the simplistic gimple_uses_undefined_value_p
with the conservative mark_ssa_maybe_undefs approach as already
used by LIM and IVOPTs.  This is to avoid exposing an unconditional
uninitialized read on a path from entry by if-combine.

PR tree-optimization/110228
* tree-ssa-ifcombine.cc (pass_tree_ifcombine::execute):
Mark SSA may-undefs.
(bb_no_side_effects_p): Check stmt uses for undefs.

* gcc.dg/torture/pr110228.c: New testcase.
* gcc.dg/uninit-pr101912.c: Un-XFAIL.
gcc/testsuite/gcc.dg/torture/pr110228.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/uninit-pr101912.c
gcc/tree-ssa-ifcombine.cc