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

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 24 01:26:06 PDT 2024


david-arm wrote:

@preames @fhahn After rebasing my early exit auto-vectorisation patch on top of this one, I realised some of the tests no longer vectorise because isDereferenceAndAlignedInLoop now returns false for some cases. In particular, if a function argument has the attribute `dereferenceable(100)` then the SCEV min/max code fails to return a SCEVConstant. This is because it is unable to determine that a calculation such as (ptr + offset) will not wrap. I don't think there is a fundamental issue blocking this - it's just that the function `ScalarEvolution::getRangeRef` knows about allocas, but doesn't know about the dereferenceable attribute.

So the question is - are we happy with accepting these minor regressions when using SCEV for now? Or is it worth creating a new patch to teach `ScalarEvolution::getRangeRef` new tricks first?

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


More information about the llvm-commits mailing list