[llvm] [LoopVectorize] Vectorize fixed-order recurrence with vscale x 1. (PR #142772)

Mel Chen via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 9 03:14:21 PDT 2025


================
@@ -6139,11 +6139,6 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I,
 
     // First-order recurrences are replaced by vector shuffles inside the loop.
     if (VF.isVector() && Legal->isFixedOrderRecurrence(Phi)) {
-      // For <vscale x 1 x i64>, if vscale = 1 we are unable to extract the
----------------
Mel-Chen wrote:

47c926055efa9d261d967ba6027bfcad03103cdf
This TODO should be kept.
https://github.com/Mel-Chen/llvm-project/commit/d63194a12f614a2952a27a222f58bd7a6ec81220
I tried tightening the condition for clamping the VF range, but it seems to get stuck on the design of ExtractLastElement and VPLane.
I removed the assertion as work-around way. While it appears to produce correct IR, I believe there must be a better solution.

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


More information about the llvm-commits mailing list