Refactor peel_iters_{pro,epi}logue cost model handlings

Richard Sandiford richard.sandiford@arm.com
Mon Jul 27 13:10:50 GMT 2020


"Kewen.Lin" <linkw@linux.ibm.com> writes:
> Hi,
>
> As Richard S. suggested in the thread:
>
> https://gcc.gnu.org/pipermail/gcc-patches/2020-July/550633.html
>
> this patch is separated from the one of that thread, mainly to refactor the
> existing peel_iters_{pro,epi}logue cost model handlings.
>
> I've addressed Richard S.'s review comments there, moreover because of one
> failure of aarch64 testing, I updated it a bit more to keep the logic unchanged
> as before first (refactor_cost.diff).

Heh, nice when a clean-up exposes an existing bug. ;-)  I agree the
updates look correct.  E.g. if vf is 1, we should assume that there
are no peeled iterations even if the number of iterations is unknown.

Both patches are OK with some very minor nits (sorry):

> gcc/ChangeLog:
>
> 	* tree-vect-loop.c (vect_get_known_peeling_cost): Factor out some code
> 	to determine peel_iters_epilogue to function ...
> 	(vect_get_peel_iters_epilogue): ... this.  New function.

to determine peel_iters_epilogue to...
(vect_get_peel_iters_epilogue): ...this new function.

> +      if (dump_enabled_p ())
> +	dump_printf (MSG_NOTE, "cost model: "
> +			       "prologue peel iters set to vf/2.\n");

Agree this looks nice, but the old formatting was correct: the string
should be indented under “MSG_NOTE, ”.  Same for the epilogue.

> +      /* If peeled iterations are unknown, count a taken branch and a not taken
> +	 branch per peeled loop. Even if scalar loop iterations are known,
> +	 vector iterations are not known since peeled prologue iterations are
> +	 not known. Hence guards remain the same.  */

Should be two spaces rather than one space before “Hence”.

Thanks for doing this.

Richard


More information about the Gcc-patches mailing list