vect: Don't consider branch costs if no peeled iterations
authorKewen Lin <linkw@linux.ibm.com>
Fri, 31 Jul 2020 12:49:39 +0000 (07:49 -0500)
committerKewen Lin <linkw@linux.ibm.com>
Fri, 31 Jul 2020 13:16:42 +0000 (08:16 -0500)
commitc89366b12ff4f36253bae125b794cbe687f7e40b
tree82ed9ae4b4046b9d619dcd0b006d13b78bace89a
parent89db36b05ea7df12926d198ec4b1be69af1b6555
vect: Don't consider branch costs if no peeled iterations

Currently vectorizer cost modeling counts branch taken costs for
prologue and epilogue if the number of iterations is unknown.
But it isn't sensible if there are no peeled iterations.

This patch is to guard them under peel_iters_prologue > 0 or
peel_iters_epilogue > 0.

Bootstrapped/regtested on powerpc64le-linux-gnu and aarch64-linux-gnu.

gcc/ChangeLog:

* tree-vect-loop.c (vect_get_known_peeling_cost): Don't consider branch
taken costs for prologue and epilogue if they don't exist.
(vect_estimate_min_profitable_iters): Likewise.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/sve/cost_model_2.c: Adjust due to cost model
change.
gcc/testsuite/gcc.target/aarch64/sve/cost_model_2.c
gcc/tree-vect-loop.c