[llvm] [LV] Support binary and unary operations with EVL-vectorization (PR #93854)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 26 05:56:01 PDT 2024


================
@@ -1214,6 +1218,47 @@ InstructionCost VPWidenRecipe::computeCost(ElementCount VF,
   }
 }
 
+void VPWidenEVLRecipe::execute(VPTransformState &State) {
+  State.setDebugLocFrom(getDebugLoc());
+  assert(State.UF == 1 && "Expected only UF == 1 when vectorizing with "
+                          "explicit vector length.");
+  VPValue *Op0 = getOperand(0);
+
+  assert(State.get(Op0, 0)->getType()->isVectorTy() &&
+         "VPWidenEVLRecipe should not be used for scalars");
+
+  VPValue *EVL = getEVL();
+  Value *EVLArg = State.get(EVL, 0, /*NeedsScalar=*/true);
+  unsigned Opcode = getOpcode();
+  Instruction *I = getUnderlyingInstr();
----------------
fhahn wrote:

Would be good to sink to last remaining use, and use `if (dyn_cast_or_null....` to make underlying instruction optional

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


More information about the llvm-commits mailing list