[llvm] LAA: refine condition for invariant stores (PR #124567)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 27 07:55:24 PST 2025


================
@@ -2545,7 +2545,8 @@ bool LoopAccessInfo::analyzeLoop(AAResults *AA, const LoopInfo *LI,
   for (StoreInst *ST : Stores) {
     Value *Ptr = ST->getPointerOperand();
 
-    if (isInvariant(Ptr)) {
+    const SCEV *PtrScev = replaceSymbolicStrideSCEV(*PSE, SymbolicStrides, Ptr);
----------------
david-arm wrote:

At first I couldn't really understand how this change is linked to the test changes in llvm/test/Transforms/LoopVectorize/version-stride-with-integer-casts.ll because there are no loop invariant pointers in that test. However, I guess the intention here is to simply add predicates for strides of 1 in the same way we do for loads below. And since you have a SCEV object it makes sense to call `PSE->getSE()->isLoopInvariant()` instead.

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


More information about the llvm-commits mailing list