https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106950
Bug ID: 106950
Summary: Missed PRE full redundancy without post-loop use
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: rguenth at gcc dot gnu.org
Target Milestone: ---
when we have the situation of PR106922, aka g++.dg/tree-ssa/pr106922.C which is
XFAILed on !lp64 because of this there's
mem = 0;
do
{
if (mem)
mem = 0;
if (mem) // as 'char' instead of 'bool', maybe relevant
bar ();
if (i++ != n)
break;
}
while (1);
.. = mem;
with the use of 'mem' after the loop we get that antic-in in the loop
exit condition block and eventually figure the full redundancy in
the conditional redundant set to zero during PRE insertion. When that
'mem' after the loop is _not_ there this isn't triggered (possibly
because of the 'char' vs. 'bool' here, but then one can eventually
elide the whole if (mem) bar () code).