On 01/08/2016 14:49, "Richard Biener" <richard.guent...@gmail.com> wrote:
>On Mon, Aug 1, 2016 at 11:24 AM, Alan Hayward <alan.hayw...@arm.com> >wrote: >> In the given test case, the loop is split into vectorised and non >> vectorised >> versions due to peeling. At the end of the loop the IVs are incremented >>to >> their latest value. This is achieved by taking the base of the loop >>(g_21) >> and >> adding the iterations (240) multiplied by the step (_6): >> >> <bb 15>: >> # _106 = PHI <_6(12)> >> _84 = _106 * 240; >> _85 = (char) _84; >> tmp.19_83 = g_21(D) + _85; >> >> However, the step (_6) varies within the loop and therefore the >> calculation is >> incorrect. >> >> This patch fixes the error by disallowing vectorization if the step of >>the >> IV >> is not an invariant within the loop. >> >> Also added debug comment for when the optimisation fails due to chrec. >> >> Tested on x86. >> >> Ok to commit? > >Ok. > >To fix this we'd have to vectorize the induction variable itself, correct? Yes, then extract final value with BIT_FIELD_REF (like vectorise_live_operation). Alan.