@@ -7616,14 +7616,13 @@ VPWidenMemoryRecipe *VPRecipeBuilder::tryToWidenMemory(VPInstruction *VPI,
76167616 }
76177617 if (VPI->getOpcode () == Instruction::Load) {
76187618 auto *Load = cast<LoadInst>(I);
7619- return new VPWidenLoadRecipe (*Load, Ptr, Mask, Consecutive, Reverse,
7620- VPIRMetadata (*Load, LVer), I ->getDebugLoc ());
7619+ return new VPWidenLoadRecipe (*Load, Ptr, Mask, Consecutive, Reverse, *VPI,
7620+ VPI ->getDebugLoc ());
76217621 }
76227622
76237623 StoreInst *Store = cast<StoreInst>(I);
76247624 return new VPWidenStoreRecipe (*Store, Ptr, VPI->getOperand (0 ), Mask,
7625- Consecutive, Reverse,
7626- VPIRMetadata (*Store, LVer), VPI->getDebugLoc ());
7625+ Consecutive, Reverse, *VPI, VPI->getDebugLoc ());
76277626}
76287627
76297628// / Creates a VPWidenIntOrFpInductionRecipe for \p PhiR. If needed, it will
@@ -7751,7 +7750,7 @@ VPSingleDefRecipe *VPRecipeBuilder::tryToWidenCall(VPInstruction *VPI,
77517750 },
77527751 Range);
77537752 if (ShouldUseVectorIntrinsic)
7754- return new VPWidenIntrinsicRecipe (*CI, ID, Ops, CI->getType (),
7753+ return new VPWidenIntrinsicRecipe (*CI, ID, Ops, CI->getType (), *VPI,
77557754 VPI->getDebugLoc ());
77567755
77577756 Function *Variant = nullptr ;
@@ -7843,7 +7842,7 @@ VPWidenRecipe *VPRecipeBuilder::tryToWiden(VPInstruction *VPI) {
78437842 auto *SafeRHS =
78447843 Builder.createSelect (Mask, Ops[1 ], One, VPI->getDebugLoc ());
78457844 Ops[1 ] = SafeRHS;
7846- return new VPWidenRecipe (*I, Ops);
7845+ return new VPWidenRecipe (*I, Ops, *VPI, VPI-> getDebugLoc () );
78477846 }
78487847 [[fallthrough]];
78497848 }
@@ -7889,15 +7888,15 @@ VPWidenRecipe *VPRecipeBuilder::tryToWiden(VPInstruction *VPI) {
78897888 // For other binops, the legacy cost model only checks the second operand.
78907889 NewOps[1 ] = GetConstantViaSCEV (NewOps[1 ]);
78917890 }
7892- return new VPWidenRecipe (*I, NewOps);
7891+ return new VPWidenRecipe (*I, NewOps, *VPI, VPI-> getDebugLoc () );
78937892 }
78947893 case Instruction::ExtractValue: {
78957894 SmallVector<VPValue *> NewOps (VPI->operands ());
78967895 auto *EVI = cast<ExtractValueInst>(I);
78977896 assert (EVI->getNumIndices () == 1 && " Expected one extractvalue index" );
78987897 unsigned Idx = EVI->getIndices ()[0 ];
78997898 NewOps.push_back (Plan.getConstantInt (32 , Idx));
7900- return new VPWidenRecipe (*I, NewOps);
7899+ return new VPWidenRecipe (*I, NewOps, *VPI, VPI-> getDebugLoc () );
79017900 }
79027901 };
79037902}
@@ -7981,8 +7980,8 @@ VPReplicateRecipe *VPRecipeBuilder::handleReplication(VPInstruction *VPI,
79817980 assert ((Range.Start .isScalar () || !IsUniform || !IsPredicated ||
79827981 (Range.Start .isScalable () && isa<IntrinsicInst>(I))) &&
79837982 " Should not predicate a uniform recipe" );
7984- auto *Recipe = new VPReplicateRecipe (I, VPI-> operands (), IsUniform,
7985- BlockInMask, VPIRMetadata (*I, LVer) );
7983+ auto *Recipe =
7984+ new VPReplicateRecipe (I, VPI-> operands (), IsUniform, BlockInMask, *VPI );
79867985 return Recipe;
79877986}
79887987
@@ -8235,13 +8234,14 @@ VPRecipeBase *VPRecipeBuilder::tryToCreateWidenRecipe(VPSingleDefRecipe *R,
82358234 return new VPWidenGEPRecipe (cast<GetElementPtrInst>(Instr), R->operands ());
82368235
82378236 if (VPI->getOpcode () == Instruction::Select)
8238- return new VPWidenSelectRecipe (*cast<SelectInst>(Instr), R->operands ());
8237+ return new VPWidenSelectRecipe (*cast<SelectInst>(Instr), R->operands (),
8238+ *VPI);
82398239
82408240 if (Instruction::isCast (VPI->getOpcode ())) {
82418241 auto *CastR = cast<VPInstructionWithType>(R);
82428242 auto *CI = cast<CastInst>(Instr);
82438243 return new VPWidenCastRecipe (CI->getOpcode (), VPI->getOperand (0 ),
8244- CastR->getResultType (), *CI);
8244+ CastR->getResultType (), *CI, *VPI );
82458245 }
82468246
82478247 return tryToWiden (VPI);
@@ -8269,7 +8269,8 @@ VPRecipeBuilder::tryToCreatePartialReduction(VPInstruction *Reduction,
82698269 SmallVector<VPValue *, 2 > Ops;
82708270 Ops.push_back (Plan.getOrAddLiveIn (Zero));
82718271 Ops.push_back (BinOp);
8272- BinOp = new VPWidenRecipe (*ReductionI, Ops);
8272+ BinOp = new VPWidenRecipe (*ReductionI, Ops, VPIRMetadata (),
8273+ ReductionI->getDebugLoc ());
82738274 Builder.insert (BinOp->getDefiningRecipe ());
82748275 ReductionOpcode = Instruction::Add;
82758276 }
@@ -8302,7 +8303,7 @@ void LoopVectorizationPlanner::buildVPlansWithVPRecipes(ElementCount MinVF,
83028303 // candidates built later for specific VF ranges.
83038304 auto VPlan0 = VPlanTransforms::buildVPlan0 (
83048305 OrigLoop, *LI, Legal->getWidestInductionType (),
8305- getDebugLocFromInstOrOperands (Legal->getPrimaryInduction ()), PSE);
8306+ getDebugLocFromInstOrOperands (Legal->getPrimaryInduction ()), PSE, &LVer );
83068307
83078308 auto MaxVFTimes2 = MaxVF * 2 ;
83088309 for (ElementCount VF = MinVF; ElementCount::isKnownLT (VF, MaxVFTimes2);) {
@@ -8408,7 +8409,7 @@ VPlanPtr LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(
84088409 // VPInstructions in the loop.
84098410 // ---------------------------------------------------------------------------
84108411 VPRecipeBuilder RecipeBuilder (*Plan, OrigLoop, TLI, &TTI, Legal, CM, PSE,
8411- Builder, BlockMaskCache, LVer );
8412+ Builder, BlockMaskCache);
84128413 // TODO: Handle partial reductions with EVL tail folding.
84138414 if (!CM.foldTailWithEVL ())
84148415 RecipeBuilder.collectScaledReductions (Range);
@@ -8453,9 +8454,9 @@ VPlanPtr LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(
84538454 Legal->isInvariantAddressOfReduction (SI->getPointerOperand ())) {
84548455 // Only create recipe for the final invariant store of the reduction.
84558456 if (Legal->isInvariantStoreOfReduction (SI)) {
8456- auto *Recipe =
8457- new VPReplicateRecipe ( SI, R.operands (), true /* IsUniform */ ,
8458- nullptr /* Mask */ , VPIRMetadata (*SI, LVer ));
8457+ auto *Recipe = new VPReplicateRecipe (
8458+ SI, R.operands (), true /* IsUniform */ , nullptr /* Mask */ ,
8459+ *cast<VPInstruction>(SingleDef ));
84598460 Recipe->insertBefore (*MiddleVPBB, MBIP);
84608461 }
84618462 R.eraseFromParent ();
@@ -8606,7 +8607,7 @@ VPlanPtr LoopVectorizationPlanner::tryToBuildVPlan(VFRange &Range) {
86068607 // addScalarResumePhis.
86078608 DenseMap<VPBasicBlock *, VPValue *> BlockMaskCache;
86088609 VPRecipeBuilder RecipeBuilder (*Plan, OrigLoop, TLI, &TTI, Legal, CM, PSE,
8609- Builder, BlockMaskCache, nullptr /* LVer */ );
8610+ Builder, BlockMaskCache);
86108611 for (auto &R : Plan->getVectorLoopRegion ()->getEntryBasicBlock ()->phis ()) {
86118612 if (isa<VPCanonicalIVPHIRecipe>(&R))
86128613 continue ;
0 commit comments