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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 24 14:45:09 PDT 2024


https://github.com/fhahn commented:

> @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?

That's interesting! Is it possible that the current tests don't catch this issue because `load-deref-pred-align.ll` doesn't have a variant with `dereferenceable()`?

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


More information about the llvm-commits mailing list