[llvm] [LV] Support binary and unary operations with EVL-vectorization (PR #93854)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 21 03:58:55 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:
```suggestion
Instruction *UI = getUnderlyingInstr();
```
to avoid clash with `I` below.
The underlying instruction is only used by `State.addMetadata`, might be better to use`dyn_cast_or_null<Instruction>(getUnderlyingValue())` to make the underlying instruction optional. (getUnderlyingInstr` uses `cast<Instruction>`, which makes the underlying instruction non-optional)
https://github.com/llvm/llvm-project/pull/93854
More information about the llvm-commits
mailing list