[LV] Vectorize GEPs
authorMatthew Simpson <mssimpso@codeaurora.org>
Thu, 23 Mar 2017 16:29:58 +0000 (16:29 +0000)
committerMatthew Simpson <mssimpso@codeaurora.org>
Thu, 23 Mar 2017 16:29:58 +0000 (16:29 +0000)
commit4e7b71bc86e276bb87a4af7b457367f15eba00f2
treeb5bbb82388b14923560733a5cf089b241439e0ec
parenteaada5c91e986ec595dc9661c5f9232d63f988c8
[LV] Vectorize GEPs

This patch adds support for vectorizing GEPs. Previously, we only generated
vector GEPs on-demand when creating gather or scatter operations. All GEPs from
the original loop were scalarized by default, and if a pointer was to be stored
to memory, we would have to build up the pointer vector with insertelement
instructions.

With this patch, we will vectorize all GEPs that haven't already been marked
for scalarization.

The patch refines collectLoopScalars to more exactly identify the scalar GEPs.
The function now more closely resembles collectLoopUniforms. And the patch
moves vector GEP creation out of vectorizeMemoryInstruction and into the main
vectorization loop. The vector GEPs needed for gather and scatter operations
will have already been generated before vectoring the memory accesses.

Differential Revision: https://reviews.llvm.org/D30710

llvm-svn: 298620
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/X86/consecutive-ptr-uniforms.ll
llvm/test/Transforms/LoopVectorize/X86/scatter_crash.ll
llvm/test/Transforms/LoopVectorize/vector-geps.ll [new file with mode: 0644]