@@ -1333,18 +1333,20 @@ Value *llvm::createSimpleReduction(IRBuilderBase &Builder, Value *Src,
13331333 }
13341334}
13351335
1336- Value *llvm::createSimpleReduction (VectorBuilder &VBuilder , Value *Src,
1337- RecurKind Kind) {
1336+ Value *llvm::createSimpleReduction (IRBuilderBase &Builder , Value *Src,
1337+ RecurKind Kind, Value *Mask, Value *EVL ) {
13381338 assert (!RecurrenceDescriptor::isAnyOfRecurrenceKind (Kind) &&
13391339 !RecurrenceDescriptor::isFindLastIVRecurrenceKind (Kind) &&
13401340 " AnyOf or FindLastIV reductions are not supported." );
13411341 Intrinsic::ID Id = getReductionIntrinsicID (Kind);
1342- auto *SrcTy = cast<VectorType>(Src->getType ());
1343- Type *SrcEltTy = SrcTy->getElementType ();
1342+ auto VPID = VPIntrinsic::getForIntrinsic (Id);
1343+ assert (VPReductionIntrinsic::isVPReduction (VPID) &&
1344+ " No VPIntrinsic for this reduction" );
1345+ auto *EltTy = cast<VectorType>(Src->getType ())->getElementType ();
13441346 Value *Iden =
1345- getRecurrenceIdentity (Kind, SrcEltTy, VBuilder .getFastMathFlags ());
1346- Value *Ops[] = {Iden, Src};
1347- return VBuilder. createSimpleReduction (Id, SrcTy , Ops);
1347+ getRecurrenceIdentity (Kind, EltTy, Builder .getFastMathFlags ());
1348+ Value *Ops[] = {Iden, Src, Mask, EVL };
1349+ return Builder. CreateIntrinsic (EltTy, VPID , Ops);
13481350}
13491351
13501352Value *llvm::createOrderedReduction (IRBuilderBase &B, RecurKind Kind,
@@ -1357,17 +1359,21 @@ Value *llvm::createOrderedReduction(IRBuilderBase &B, RecurKind Kind,
13571359 return B.CreateFAddReduce (Start, Src);
13581360}
13591361
1360- Value *llvm::createOrderedReduction (VectorBuilder &VBuilder, RecurKind Kind,
1361- Value *Src, Value *Start) {
1362+ Value *llvm::createOrderedReduction (IRBuilderBase &Builder, RecurKind Kind,
1363+ Value *Src, Value *Start, Value *Mask,
1364+ Value *EVL) {
13621365 assert ((Kind == RecurKind::FAdd || Kind == RecurKind::FMulAdd) &&
13631366 " Unexpected reduction kind" );
13641367 assert (Src->getType ()->isVectorTy () && " Expected a vector type" );
13651368 assert (!Start->getType ()->isVectorTy () && " Expected a scalar type" );
13661369
13671370 Intrinsic::ID Id = getReductionIntrinsicID (RecurKind::FAdd);
1368- auto *SrcTy = cast<VectorType>(Src->getType ());
1369- Value *Ops[] = {Start, Src};
1370- return VBuilder.createSimpleReduction (Id, SrcTy, Ops);
1371+ auto VPID = VPIntrinsic::getForIntrinsic (Id);
1372+ assert (VPReductionIntrinsic::isVPReduction (VPID) &&
1373+ " No VPIntrinsic for this reduction" );
1374+ auto *EltTy = cast<VectorType>(Src->getType ())->getElementType ();
1375+ Value *Ops[] = {Start, Src, Mask, EVL};
1376+ return Builder.CreateIntrinsic (EltTy, VPID, Ops);
13711377}
13721378
13731379void llvm::propagateIRFlags (Value *I, ArrayRef<Value *> VL, Value *OpValue,
0 commit comments