Hello, Is there a way to pass to the unroller the maximum number of iterations of the loop such that it can decide to avoid unrolling if the maximum number is small.
To be more specific, I am referring to the following case: After the vectorizer decides to peel for alignment it creates three loops: [1] scalar loop - the prologue to align memory access. [2] the vecorized loop [3] scalar loop - the remaining scalar computations. If the unroller does not know the number of iterations at compile time it unrolls loops with run-time checks in the following way (taken from loop-unroll.c): for (i = 0; i < n; i++) body; ==> i = 0; mod = n % 4; switch (mod) { case 3: body; i++; case 2: body; i++; case 1: body; i++; case 0: ; } while (i < n) { body; i++; body; i++; body; i++; body; i++; } The vectorizer knowns at compile time the maximum number of iterations that will be needed for the prologue and the epilogue. In some cases seems there is no need to unroll and create redundant loops. Thanks, Revital