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

Tamar Christina <tnfchris at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-03-01

--- Comment #1 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
Confirmed.

It looks like DCE6 no longer thinks:

  # sum_10 = PHI <sum_7(7), 0(11)>

  _1 = aD.4432[i_12];
  sum_7 = _1 + sum_11;

is dead after vectorization.

it removes the only dead consumer of sum_7,
a PHI node left over in the guard block which becomes unused after the
reduction is vectorized.

DCE says:

marking necessary through sum_11 stmt sum_11 = PHI <sum_7(7), 0(11)>
processing: sum_11 = PHI <sum_7(7), 0(11)>

marking necessary through sum_7 stmt sum_7 = _1 + sum_11;
processing: sum_7 = _1 + sum_11;

marking necessary through _1 stmt _1 = a[i_12];
processing: _1 = a[i_12];

so it thinks the closed definition is needed?

This seems to only happen with reductions, other live operations look fine:

extern int a[1024];
int f4(int *x, int n)
{
    int sum = 0;
    for (int i = 0; i < n; i++)
    {
        sum = a[i];
        if (a[i] == 42)
            break;
    }
    return sum;
}

Reply via email to