@@ -8418,7 +8418,7 @@ VPRecipeBuilder::tryToWidenMemory(Instruction *I, ArrayRef<VPValue *> Operands,
8418
8418
8419
8419
VPValue *Mask = nullptr;
8420
8420
if (Legal->isMaskRequired(I))
8421
- Mask = getBlockInMask(I->getParent ());
8421
+ Mask = getBlockInMask(Builder.getInsertBlock ());
8422
8422
8423
8423
// Determine if the pointer operand of the access is either consecutive or
8424
8424
// reverse consecutive.
@@ -8645,7 +8645,7 @@ VPSingleDefRecipe *VPRecipeBuilder::tryToWidenCall(CallInst *CI,
8645
8645
// all-true mask.
8646
8646
VPValue *Mask = nullptr;
8647
8647
if (Legal->isMaskRequired(CI))
8648
- Mask = getBlockInMask(CI->getParent ());
8648
+ Mask = getBlockInMask(Builder.getInsertBlock ());
8649
8649
else
8650
8650
Mask = Plan.getOrAddLiveIn(
8651
8651
ConstantInt::getTrue(IntegerType::getInt1Ty(CI->getContext())));
@@ -8687,7 +8687,7 @@ VPWidenRecipe *VPRecipeBuilder::tryToWiden(Instruction *I,
8687
8687
// div/rem operation itself. Otherwise fall through to general handling below.
8688
8688
if (CM.isPredicatedInst(I)) {
8689
8689
SmallVector<VPValue *> Ops(Operands);
8690
- VPValue *Mask = getBlockInMask(I->getParent ());
8690
+ VPValue *Mask = getBlockInMask(Builder.getInsertBlock ());
8691
8691
VPValue *One =
8692
8692
Plan.getOrAddLiveIn(ConstantInt::get(I->getType(), 1u, false));
8693
8693
auto *SafeRHS = Builder.createSelect(Mask, Ops[1], One, I->getDebugLoc());
@@ -8769,7 +8769,7 @@ VPRecipeBuilder::tryToWidenHistogram(const HistogramInfo *HI,
8769
8769
// In case of predicated execution (due to tail-folding, or conditional
8770
8770
// execution, or both), pass the relevant mask.
8771
8771
if (Legal->isMaskRequired(HI->Store))
8772
- HGramOps.push_back(getBlockInMask(HI->Store->getParent ()));
8772
+ HGramOps.push_back(getBlockInMask(Builder.getInsertBlock ()));
8773
8773
8774
8774
return new VPHistogramRecipe(Opcode, HGramOps, HI->Store->getDebugLoc());
8775
8775
}
@@ -8823,7 +8823,7 @@ VPRecipeBuilder::handleReplication(Instruction *I, ArrayRef<VPValue *> Operands,
8823
8823
// added initially. Masked replicate recipes will later be placed under an
8824
8824
// if-then construct to prevent side-effects. Generate recipes to compute
8825
8825
// the block mask for this region.
8826
- BlockInMask = getBlockInMask(I->getParent ());
8826
+ BlockInMask = getBlockInMask(Builder.getInsertBlock ());
8827
8827
}
8828
8828
8829
8829
// Note that there is some custom logic to mark some intrinsics as uniform
@@ -9067,7 +9067,7 @@ VPRecipeBuilder::tryToCreatePartialReduction(Instruction *Reduction,
9067
9067
ReductionOpcode == Instruction::Sub) &&
9068
9068
"Expected an ADD or SUB operation for predicated partial "
9069
9069
"reductions (because the neutral element in the mask is zero)!");
9070
- Cond = getBlockInMask(Reduction->getParent ());
9070
+ Cond = getBlockInMask(Builder.getInsertBlock ());
9071
9071
VPValue *Zero =
9072
9072
Plan.getOrAddLiveIn(ConstantInt::get(Reduction->getType(), 0));
9073
9073
BinOp = Builder.createSelect(Cond, BinOp, Zero, Reduction->getDebugLoc());
@@ -9847,10 +9847,9 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
9847
9847
"PreviousLink must be the operand other than VecOp");
9848
9848
}
9849
9849
9850
- BasicBlock *BB = CurrentLinkI->getParent();
9851
9850
VPValue *CondOp = nullptr;
9852
- if (CM.blockNeedsPredicationForAnyReason(BB ))
9853
- CondOp = RecipeBuilder.getBlockInMask(BB );
9851
+ if (CM.blockNeedsPredicationForAnyReason(CurrentLinkI->getParent() ))
9852
+ CondOp = RecipeBuilder.getBlockInMask(CurrentLink->getParent() );
9854
9853
9855
9854
// Non-FP RdxDescs will have all fast math flags set, so clear them.
9856
9855
FastMathFlags FMFs = isa<FPMathOperator>(CurrentLinkI)
@@ -9893,7 +9892,7 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
9893
9892
// different numbers of lanes. Partial reductions mask the input instead.
9894
9893
if (!PhiR->isInLoop() && CM.foldTailByMasking() &&
9895
9894
!isa<VPPartialReductionRecipe>(OrigExitingVPV->getDefiningRecipe())) {
9896
- VPValue *Cond = RecipeBuilder.getBlockInMask(OrigLoop->getHeader ());
9895
+ VPValue *Cond = RecipeBuilder.getBlockInMask(PhiR->getParent ());
9897
9896
Type *PhiTy = PhiR->getOperand(0)->getLiveInIRValue()->getType();
9898
9897
std::optional<FastMathFlags> FMFs =
9899
9898
PhiTy->isFloatingPointTy()
0 commit comments