[llvm] [LoopVectorize] Add the cost of VPInstruction::AnyOf to vplan (PR #125058)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 31 12:35:13 PST 2025


================
@@ -709,6 +709,20 @@ Value *VPInstruction::generate(VPTransformState &State) {
   }
 }
 
+InstructionCost VPInstruction::computeCost(ElementCount VF,
+                                           VPCostContext &Ctx) const {
+  switch (getOpcode()) {
+  case VPInstruction::AnyOf: {
+    auto *VecI1Ty = VectorType::get(Type::getInt1Ty(Ctx.LLVMCtx), VF);
----------------
fhahn wrote:

Can we just infer the result type for the recipe and use that? And the `toVectorTy` helper for consistency with other ::comptueCost implementations?

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


More information about the llvm-commits mailing list