[llvm] [X86][LoopVectorize] Enable MaximizeBandwidth by default on X86 with generic split cost floor (PR #201666)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 6 09:52:51 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).
----------------
fhahn wrote:

Yep it sounds like this is a workaround for a TTI issue in X86. If so, we should fix the root cause, instead of trying to work around in LV, which may also pessimize targets that already handle this correctly in TTI

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


More information about the llvm-commits mailing list