https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110451
Bug ID: 110451 Summary: LIM fails to hoist comparisons Product: gcc Version: 14.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: --- For SPEC bwaves or gfortran.dg/pr81303.f we interchange the loop nest which produces a conditional in the innermost loop like the following to handle a reduction with invariant initialization: <bb 14> [local count: 955630226]: # l_93 = PHI <l_94(21), 1(13)> # ivtmp_58 = PHI <ivtmp_84(21), _85(13)> _30 = (integer(kind=8)) l_93; _31 = _29 + _30; y__I_lsm.120_22 = (*y_139(D))[_31]; _23 = m_95 != 1; y__I_lsm.120_33 = _23 ? y__I_lsm.120_22 : 0.0; _42 = _30 + _41; _43 = (*a_141(D))[_42]; currently the LIM cost modeling finds it not profitable to hoist the invariant m_95 != 1 compare. This causes vectorization to choose a larger vectorization factor to accomodate vectorizing this compare.