Fix SLP score for out of order contiguous loads
SLP uses the distance between pointers to optimize the getShallowScore. However the current code misses the case where we are trying to vectorize for VF=4, and the distance between pointers is 2. In that case the returned score reflects the case of contiguous loads, when it's not actually contiguous. The attached unit tests have 5 loads, where the program order is not the same as the offset order in the GEPs. So, the choice of which 4 loads to bundle together matters. If we pick the first 4, then we can vectorize with VF=4. If we pick the last 4, then we can only vectorize with VF=2. This patch makes a more conservative choice, to consider all distances>1 to not be a case of contiguous load, and give those cases a lower score. Reviewed By: ABataev Differential Revision: https://reviews.llvm.org/D123516
Loading
Please sign in to comment