[VectorCombine] allow peeking through GEPs when creating a vector load
authorSanjay Patel <spatel@rotateright.com>
Fri, 18 Dec 2020 13:49:05 +0000 (08:49 -0500)
committerSanjay Patel <spatel@rotateright.com>
Fri, 18 Dec 2020 14:25:03 +0000 (09:25 -0500)
commit47aaa99c0e1e28573bf24d95c5540005ee734531
tree0c2226ea11b45b6fdba21a2b36e8233115ccd43c
parent0336ff0a17e6aec831334aeb50e6685f6b184065
[VectorCombine] allow peeking through GEPs when creating a vector load

This is an enhancement motivated by https://llvm.org/PR16739
(see D92858 for another).

We can look through a GEP to find a base pointer that may be
safe to use for a vector load. If so, then we shuffle (shift)
the necessary vector element over to index 0.

Alive2 proof based on 1 of the regression tests:
https://alive2.llvm.org/ce/z/yPJLkh

The vector translation is independent of endian (verify by
changing to leading 'E' in the datalayout string).

Differential Revision: https://reviews.llvm.org/D93229
llvm/lib/Transforms/Vectorize/VectorCombine.cpp
llvm/test/Transforms/VectorCombine/X86/load.ll