@@ -954,45 +954,31 @@ void VPWidenIntrinsicRecipe::execute(VPTransformState &State) {
954
954
Args.push_back (Arg);
955
955
}
956
956
957
- if (VPIntrinsic::isVPIntrinsic (VectorIntrinsicID) &&
958
- VectorIntrinsicID != Intrinsic::vp_select) {
959
- VectorBuilder VBuilder (State.Builder );
960
- Value *Mask =
961
- State.Builder .CreateVectorSplat (State.VF , State.Builder .getTrue ());
962
- VBuilder.setMask (Mask).setEVL (Args.back ());
963
- // Remove EVL from Args
964
- Args.pop_back ();
965
-
966
- Value *VPInst = VBuilder.createSimpleIntrinsic (
967
- VectorIntrinsicID, TysForDecl[0 ], Args, " vp.call" );
968
-
969
- if (isa<FPMathOperator>(VPInst))
970
- setFlags (cast<Instruction>(VPInst));
971
-
972
- if (!VPInst->getType ()->isVoidTy ())
973
- State.set (this , VPInst);
974
- State.addMetadata (VPInst,
975
- dyn_cast_or_null<Instruction>(getUnderlyingValue ()));
976
- } else {
977
- // Use vector version of the intrinsic.
978
- Module *M = State.Builder .GetInsertBlock ()->getModule ();
979
- Function *VectorF =
980
- Intrinsic::getOrInsertDeclaration (M, VectorIntrinsicID, TysForDecl);
981
- assert (VectorF && " Can't retrieve vector intrinsic." );
982
-
983
- auto *CI = cast_or_null<CallInst>(getUnderlyingValue ());
984
- SmallVector<OperandBundleDef, 1 > OpBundles;
985
- if (CI)
986
- CI->getOperandBundlesAsDefs (OpBundles);
957
+ // Use vector version of the intrinsic.
958
+ Module *M = State.Builder .GetInsertBlock ()->getModule ();
959
+ bool IsVPIntrinsic = VPIntrinsic::isVPIntrinsic (VectorIntrinsicID);
960
+ Function *VectorF =
961
+ Intrinsic::getOrInsertDeclaration (M, VectorIntrinsicID, TysForDecl);
962
+ assert (VectorF && " Can't retrieve vector intrinsic." );
987
963
988
- CallInst *V = State.Builder .CreateCall (VectorF, Args, OpBundles);
964
+ SmallVector<OperandBundleDef, 1 > OpBundles;
965
+ if (!IsVPIntrinsic) {
966
+ if (auto *CI = cast_or_null<CallInst>(getUnderlyingValue ()))
967
+ CI->getOperandBundlesAsDefs (OpBundles);
968
+ }
989
969
990
- setFlags (V );
970
+ Value *V = State. Builder . CreateCall (VectorF, Args, OpBundles );
991
971
992
- if (!V->getType ()->isVoidTy ())
993
- State.set (this , V);
994
- State.addMetadata (V, CI);
972
+ if (IsVPIntrinsic) {
973
+ if (isa<FPMathOperator>(V))
974
+ setFlags (cast<Instruction>(V));
975
+ } else {
976
+ setFlags (cast<Instruction>(V));
995
977
}
978
+
979
+ if (!V->getType ()->isVoidTy ())
980
+ State.set (this , V);
981
+ State.addMetadata (V, dyn_cast_or_null<Instruction>(getUnderlyingValue ()));
996
982
}
997
983
998
984
InstructionCost VPWidenIntrinsicRecipe::computeCost (ElementCount VF,
0 commit comments