[llvm] [Delinearization] Limit the scope of collecting strides (PR #206688)

Ryotaro Kasuga via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 30 03:39:35 PDT 2026


https://github.com/kasuga-fj updated https://github.com/llvm/llvm-project/pull/206688

>From bce167d86af72ec4c9a98683a1afed854da4819e Mon Sep 17 00:00:00 2001
From: Ryotaro Kasuga <kasuga.ryotaro at fujitsu.com>
Date: Fri, 26 Jun 2026 13:26:48 +0000
Subject: [PATCH] [Delinearization] Limit the scope of collecting strides

---
 llvm/lib/Analysis/Delinearization.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Analysis/Delinearization.cpp b/llvm/lib/Analysis/Delinearization.cpp
index 5b525b43e4931..cbde9f473e07b 100644
--- a/llvm/lib/Analysis/Delinearization.cpp
+++ b/llvm/lib/Analysis/Delinearization.cpp
@@ -56,8 +56,11 @@ struct SCEVCollectStrides {
       : SE(SE), Strides(S) {}
 
   bool follow(const SCEV *S) {
-    if (const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(S))
-      Strides.push_back(AR->getStepRecurrence(SE));
+    const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(S);
+    if (!AR || !AR->isAffine())
+      return false;
+
+    Strides.push_back(AR->getStepRecurrence(SE));
     return true;
   }
 



More information about the llvm-commits mailing list