The current implementation of isConsecutiveAccess(A,B) checks to see if access A is consecutively followed by access B. With little additional work we can determine if B is followed by A (i.e., reverse consecutive) or if A and B are not known to be consecutive.
This patch modifies isConsecutiveAccess to:
- return 1 if A and B are consecutive and B follows A,
- return -1 if A and B are consecutive and A follows B (i.e., reverse consecutive) or,
- return 0 if we can't prove and A and B to be consecutive.
This is very similar to the behavior of the isConsecutivePtr function in the loop vectorizer and IMO having isConsecutiveAccess follow suit makes sense.
This patch also uses this new functionality to reduce the number of calls to isConsecutiveAccesses in the SLP vectorizer.
Across SPEC2000 and SPEC2006 the total number of calls to isConsecutiveAccess is reduced by 4.31% or 18875 calls. There should be no functional change other than the reduction is calls.
All of the SPEC200X and llvm test-suite tests passed correctness tests and show no codegen changes as expected. I plan on kicking off the compile-time regression tests over the weekend.
Chad
Any compelling reason not to make this an enum?