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

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 8 04:47:47 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;
----------------
david-arm wrote:

I imagine this instruction appears in the middle block for some outside uses of loop variables and @fhahn is trying to avoid regressions in cases where VF=1, IC>1.

@fhahn Is it worth committing this change separately as I think it makes sense on it's own? That way if this PR needs reverting due to some post-commit regression at least we don't have to revert this bit.

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


More information about the llvm-commits mailing list