[llvm] [LV] Skip sentinel value for FindLastIV reductions when start value is provably less than IV start. (PR #141788)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Thu May 29 01:18:37 PDT 2025


================
@@ -9625,7 +9626,8 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
       // Adjust the start value for FindLastIV recurrences to use the sentinel
       // value after generating the ResumePhi recipe, which uses the original
       // start value.
-      PhiR->setOperand(0, Plan->getOrAddLiveIn(RdxDesc.getSentinelValue()));
+      if (auto *Sentinel = RdxDesc.getSentinelValue())
+        PhiR->setOperand(0, Plan->getOrAddLiveIn(Sentinel));
----------------
artagnon wrote:

Use the same `&& RdxDesc.getSentinelValue()` as part of the if?

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


More information about the llvm-commits mailing list