We have two versions of isConsecutiveAccess() in tree. The instance in the LoopAccessAnalysis is used to drive the SLP vectorizer
and to some degree the Loop Idiom Recognition pass. The other instance was recently committed with the LoadStoreVectorizer,
which has additional logic to deal with gep patterns that include zexts and sexts. This is useful to figure out that accesses
A[3*i], A[3*i+1] and A[3*i+2] are consecutive which SCEV currently fails to recognize.
This patch ports the additional logic from the LoadStoreVectorizer and merges the two versions into the LoopAccessAnalysis version.
Contributed-by: Chad Rosier <mcrosier@codeaurora.org>
It's probably not a big deal, but this part makes me wonder about compile-time a little. In SLP, for example, we can call isConsecutiveAccess in an N^2 algorithm (e.g., when we try and sort a set of stores). Is computeKNownBits smart about caching results or does it always traverse the expression tree?
It may be rare that we ever reach this code, though.