[llvm] [LV] Simplify the reduction initial value (PR #198451)

Liao Chunyu via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 8 01:01:58 PDT 2026


================
@@ -7096,6 +7096,29 @@ void LoopVectorizationPlanner::addReductionResultComputation(
           Builder.createScalarCast(ExtendOpc, FinalReductionResult, PhiTy, {});
     }
 
+    RecurKind RK = PhiR->getRecurrenceKind();
+    bool SimplifyInit = false;
+    if (!PhiR->isInLoop() && CM.foldTailWithEVL() &&
----------------
ChunyuLiao wrote:

try to use cost-driven approach and create a transformation to optimize the reduction initial.

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


More information about the llvm-commits mailing list