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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tnfchris at gcc dot gnu.org
           Keywords|                            |ice-on-valid-code,
                   |                            |wrong-code

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
For the epilog LC-SSA we lack the correct SSA name for the skip edge:


<bb 38> [local count: 16140304]:
# prephitmp_78 = PHI <prephitmp_61(35), prephitmp_64(32)>
# c_I_lsm.18_79 = PHI <c_I_lsm.18_60(35), c_I_lsm.18_60(32)>
# iftmp.0_80 = PHI <iftmp.0_59(35), iftmp.0_66(32)>

see how c_I_lsm.18_60 is used for both args but the name is defined in
the epilog only.

Though it looks like the original reduction variable isn't computed
at all for the loop which means the reduction vectorization is wrong.

if-conversion turns

<bb 11> [local count: 146730041]:
# d.12_13 = PHI <d.12_5(18), _37(15)>
_1 = a.3_23 >> b.2_22;
if (_1 != 0)
  goto <bb 13>; [50.00%]
else
  goto <bb 14>; [50.00%]

<bb 14> [local count: 146730041]:

# iftmp.0_9 = PHI <1(13), iftmp.0_39(11)>
# c_I_lsm.18_38 = PHI <1(13), a.3_23(11)>
# prephitmp_43 = PHI <1(13), a.3_23(11)>
_37 = d.12_13 + 1;
if (_37 != 0)
  goto <bb 15>; [89.00%]
else
  goto <bb 19>; [11.00%]

into

<bb 11> [local count: 146730041]:
# d.12_13 = PHI <_37(15), d.12_5(26)>
iftmp.0_9 = _32 ? 1 : iftmp.0_39;
c_I_lsm.18_38 = _32 ? 1 : a.3_23;
_37 = d.12_13 + 1;
if (_37 != 0)
  goto <bb 15>; [89.00%]
else
  goto <bb 19>; [11.00%]

turning c_I_lsm.18_38 into a fully invariant reduction def which likely isn't
supported - we had bugs here in the past with not relevant but live stmts.
But if-conversion also performs the (now valid) hoisting, this is maybe
why it was triggered by that rev.

Reply via email to