[llvm] [LV] Add initial support for vectorizing literal struct return values (PR #109833)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 14 03:42:18 PST 2025


================
@@ -5578,10 +5579,13 @@ InstructionCost LoopVectorizationCostModel::computePredInstDiscount(
     // and phi nodes.
     TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput;
     if (isScalarWithPredication(I, VF) && !I->getType()->isVoidTy()) {
-      ScalarCost += TTI.getScalarizationOverhead(
-          cast<VectorType>(toVectorTy(I->getType(), VF)),
-          APInt::getAllOnes(VF.getFixedValue()), /*Insert*/ true,
-          /*Extract*/ false, CostKind);
+      Type *WideTy = toVectorizedTy(I->getType(), VF);
----------------
david-arm wrote:

I think it would be good to have some cost model tests showing what happens in different scenarios when you have call instructions in a loop that return a struct. In particular, it would be good to have tests that exercise this code path.

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


More information about the llvm-commits mailing list