https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89247

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think this is a duplicate of that other bug, at least I seem to remember
seeing this:

<bb 16> [local count: 536817226]:
# prephitmp_12 = PHI <1(15)>
if (prephitmp_12 != 0)
  goto <bb 10>; [50.00%]
else
  goto <bb 17>; [50.00%]

when we if-convert this CFG cleanup elides the loop.  It is ch_vect
that leaves us with this PHI when it operates on

<bb 2> [local count: 53687]:
a.0_1 = a;
pretmp_4 = *a.0_1;

<bb 3> [local count: 536870913]:
# prephitmp_5 = PHI <1(5), pretmp_4(2)>
d:
if (prephitmp_5 != 0)
  goto <bb 10>; [50.00%]
else
  goto <bb 5>; [50.00%]

<bb 5> [local count: 536870913]:
*a.0_1 = 1;
goto <bb 3>; [100.00%]

on trunk we run CSE on the copied blocks but not the resulting loop body.
If we CSE also the loop body the PR is fixed but the expense is possibly
too large?  Another possibility is to somehow link .LOOP_VECTORIZED from
loop info and elide that when a loop is removed (which is what happens
here).  Or simply do that in if-conversion.

Reply via email to