[llvm] [LV][EVL] Support cast instruction with EVL-vectorization (PR #108351)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 30 13:10:31 PST 2024
================
@@ -962,22 +962,35 @@ void VPWidenIntrinsicRecipe::execute(VPTransformState &State) {
// Use vector version of the intrinsic.
Module *M = State.Builder.GetInsertBlock()->getModule();
+ bool IsVPIntrinsic = VPIntrinsic::isVPIntrinsic(VectorIntrinsicID);
Function *VectorF =
- Intrinsic::getOrInsertDeclaration(M, VectorIntrinsicID, TysForDecl);
- assert(VectorF && "Can't retrieve vector intrinsic.");
+ IsVPIntrinsic
+ ? VPIntrinsic::getOrInsertDeclarationForParams(M, VectorIntrinsicID,
+ TysForDecl[0], Args)
+ : Intrinsic::getOrInsertDeclaration(M, VectorIntrinsicID, TysForDecl);
+ assert(VectorF &&
+ "Can't retrieve vector intrinsic or vector-predication intrinsics.");
- auto *CI = cast_or_null<CallInst>(getUnderlyingValue());
SmallVector<OperandBundleDef, 1> OpBundles;
- if (CI)
- CI->getOperandBundlesAsDefs(OpBundles);
+ if (!IsVPIntrinsic) {
+ if (auto *CI = cast_or_null<CallInst>(getUnderlyingValue()))
+ CI->getOperandBundlesAsDefs(OpBundles);
+ }
- CallInst *V = State.Builder.CreateCall(VectorF, Args, OpBundles);
+ Instruction *V = State.Builder.CreateCall(VectorF, Args, OpBundles);
----------------
fhahn wrote:
Why is this needed?
https://github.com/llvm/llvm-project/pull/108351
More information about the llvm-commits
mailing list