[llvm] 480f144 - [VPlan] Use map_to_vector to create ParamTys vector (NFC). (#195931)

via llvm-commits llvm-commits at lists.llvm.org
Wed May 6 01:22:12 PDT 2026


Author: Florian Hahn
Date: 2026-05-06T09:22:07+01:00
New Revision: 480f144d06a97f4b17849bb0414af399728a896e

URL: https://github.com/llvm/llvm-project/commit/480f144d06a97f4b17849bb0414af399728a896e
DIFF: https://github.com/llvm/llvm-project/commit/480f144d06a97f4b17849bb0414af399728a896e.diff

LOG: [VPlan] Use map_to_vector to create ParamTys vector (NFC). (#195931)

Use map_to_vector to slightly simplify code.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index 11c18babd1b74..d04b5edcfc212 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -19,6 +19,7 @@
 #include "VPlanUtils.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/SmallVectorExtras.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Analysis/AssumptionCache.h"
 #include "llvm/Analysis/IVDescriptors.h"
@@ -1995,12 +1996,10 @@ static InstructionCost getCostForIntrinsics(Intrinsic::ID ID,
   }
 
   Type *RetTy = VF.isVector() ? toVectorizedTy(ScalarRetTy, VF) : ScalarRetTy;
-  SmallVector<Type *> ParamTys;
-  for (const VPValue *Op : Operands) {
-    ParamTys.push_back(VF.isVector()
-                           ? toVectorTy(Ctx.Types.inferScalarType(Op), VF)
-                           : Ctx.Types.inferScalarType(Op));
-  }
+  SmallVector<Type *> ParamTys =
+      map_to_vector(Operands, [&](const VPValue *Op) {
+        return toVectorTy(Ctx.Types.inferScalarType(Op), VF);
+      });
 
   // TODO: Rework TTI interface to avoid reliance on underlying IntrinsicInst.
   IntrinsicCostAttributes CostAttrs(


        


More information about the llvm-commits mailing list