[PATCH] Don't unroll loops in loop vectorization pass when VF is one.

Wei Mi wmi at google.com
Tue Apr 14 11:29:59 PDT 2015


On Tue, Apr 14, 2015 at 8:24 AM, James Molloy <james at jamesmolloy.co.uk> wrote:
> Hi Wei,
>
> The important difference between loopunroll and the loop vectoriser
> unrolling is alias checks and interleaving.
>
> The normal unroller will concatenate iterations, which without good alias
> analysis results in a schedule that cannot be reordered. The loop vectoriser
> will use loopaccessanalysis to plant runtime pointer checks, allowing a much
> better schedule.
>
> So I don't think your patch as-is makes sense, unless loopunrollruntime has
> grown runtime ptr check support recently.
>
> Cheers,
>
> James

Hi James,

Thank you for letting me know the usage of loopunroll inside loop
vectorizer when VF==1.

I think runtime alias check has cost, it can be beneficial for
scheduling in some cases, but it can also introduce unnecessary
computations having negative impact on performance in other cases.
Loop unroll shouldn't do such kind of check blindly. Ideally
scheduling should decide and do the transformation if it is needed.

Another point is that if vectorization is turned off, the runtime
check will be gone. It doesn't make sense to depend on vectorization
always being turned on.

I didn't see performance regressions in spec2000 and our internal
benchmarks after applying this patch on x86, but it is possible that
is because apps are not performance sensitive to compiler scheduling
since x86 is out of order. So maybe the patch at least makes sense for
x86 for now?

If you have testcase to show me the runtime alias check problem
affecting scheduling on certain platform, it will be very appreciated.

Thanks,
Wei.



More information about the llvm-commits mailing list