[llvm] [LAA] Avoid stray predicates from replaceSymStrides (PR #216350)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 03:46:55 PDT 2026


================
@@ -168,11 +168,18 @@ llvm::replaceSymbolicStrideSCEV(PredicatedScalarEvolution &PSE,
 
   ScalarEvolution *SE = PSE.getSE();
   const SCEV *CT = SE->getOne(StrideSCEV->getType());
-  PSE.addPredicate(*SE->getEqualPredicate(StrideSCEV, CT));
-  const SCEV *Expr = PSE.getSCEV(Ptr);
-
-  LLVM_DEBUG(dbgs() << "LAA: Replacing SCEV: " << *OrigSCEV
-	     << " by: " << *Expr << "\n");
+  const SCEV *Expr;
+  const SCEVPredicate *EqPred = SE->getEqualPredicate(StrideSCEV, CT);
+  if (Predicates) {
+    Predicates->push_back(EqPred);
+    Expr = SE->rewriteUsingPredicate(SE->getSCEV(Ptr), Lp,
----------------
artagnon wrote:

Ugh, yes. Thanks for the test!

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


More information about the llvm-commits mailing list