[llvm] [X86][LoopVectorize] Enable MaximizeBandwidth by default on X86 (PR #201666)

Sumukh J Bharadwaj via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 17 23:48:39 PDT 2026


================
@@ -320,6 +320,45 @@ InstructionCost VPRecipeBase::cost(ElementCount VF, VPCostContext &Ctx) {
     }
   }
 
+  // General split cost floor.  When a recipe's result type legalizes into
+  // NumParts > 1 register parts, enforce a cost floor of
+  // NumParts * computeCost(per-part VF).  This prevents TTI from
+  // underpricing wide types that exceed register width -- some TTI cost
+  // functions (e.g. for selects, intrinsics) may lack accurate split
+  // models and return optimistic costs for illegal types.  The floor
+  // is a no-op when TTI already returns a correctly scaled cost
+  // (e.g. arithmetic, which uses LT.first * OpCost internally).
----------------
amd-subharad wrote:

Agreed — the LV-side floor is gone in the latest revision, and no TTI change was needed either: every recipe already prices the split through its TTI hook (full `toVectorTy(_, VF)` scaled by `LT.first`), and casts use intentionally sub-linear tuned conversion tables that a floor would have over-costed. So there's nothing left in LV to pessimize other targets.

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


More information about the llvm-commits mailing list