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.
I think this patch makes sense on its own, but it's primarily motivated by a follow-on, which merges pointer induction variable widening with the rest of the induction widening code. The follow-on creates vector-of-pointer induction variables, and we need to be able to properly consume them.
This "IF" should be dropped, if the GEP with all LoopInvariantOperands will be in the Scalars and the getVectorValue() will know to braodcast it.
Please add TODO to the comments.