[llvm] [LV] Always include middle block cost in isOutsideLoopWorkProfitable. (PR #171102)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 8 07:04:22 PST 2025


================
@@ -1104,6 +1104,10 @@ InstructionCost VPInstruction::computeCost(ElementCount VF,
     return Ctx.TTI.getIntrinsicInstrCost(Attrs, Ctx.CostKind);
   }
   case VPInstruction::ExtractLastLane: {
+    // TODO: ExtractLastLane for scalar VF is a no-op. Remove before ::execute.
+    if (VF.isScalar())
+      return 0;
----------------
fhahn wrote:

Yep, now we may compute the costs for middle blocks with scalar VFs (when interleaving) and currently they may include ExtractLastLane.

Instead of separately landing the workaround, it may be better to first simplify them away, so there's no need for the check + TODO: https://github.com/llvm/llvm-project/pull/171145.

I've removed the code here and updated the PR to include https://github.com/llvm/llvm-project/pull/171145 for now, thanks

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


More information about the llvm-commits mailing list