[llvm] [LoopVectorize] Add support for reverse loops in isDereferenceableAndAlignedInLoop (PR #96752)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 19 05:37:06 PDT 2024


david-arm wrote:

> An alternate approach here would be to compute the AccessSize as a SCEV (which should just be umax(End,Start)-umin(Start,End) + ElementSize, and then check to see if it's a SCEVConstant. End should be evaluateAtIteration on the AddRec. The base would then be umin(End, Start) as a SCEV, and then see if it's an understandable one.
> 
> In general, doing the math manually seems like a recipe for error here.

Thanks for this suggestion @preames! It was a bit fiddly to get it working without using SCEVExpander, but I do think it's now less prone to error. As part of this patch I've also added some tests for loops with strided accesses for positive and negative steps too as we didn't seem to be testing that.

https://github.com/llvm/llvm-project/pull/96752


More information about the llvm-commits mailing list