[llvm] [VPlan] Use VPWidenIntrinsicRecipe to support binary and unary operations with EVL-vectorization (PR #114205)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 22 03:00:55 PST 2024
================
@@ -959,22 +956,30 @@ 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.");
- 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);
+ Value *V = State.Builder.CreateCall(VectorF, Args, OpBundles);
- setFlags(V);
+ if (IsVPIntrinsic) {
+ if (isa<FPMathOperator>(V))
+ // Currently vp-intrinsics only accept FMF flags.
+ setFlags(cast<Instruction>(V));
+ } else {
+ setFlags(cast<Instruction>(V));
+ }
----------------
alexey-bataev wrote:
```suggestion
setFlags(V);
} else {
setFlags(V);
}
```
https://github.com/llvm/llvm-project/pull/114205
More information about the llvm-commits
mailing list