@@ -863,10 +863,10 @@ VPlan::~VPlan() {
863863 delete BackedgeTakenCount;
864864}
865865
866- static VPIRBasicBlock *createVPIRBasicBlockFor (BasicBlock *BB ) {
867- auto *VPIRBB = new VPIRBasicBlock (BB );
866+ VPIRBasicBlock *VPIRBasicBlock::fromBasicBlock (BasicBlock *IRBB ) {
867+ auto *VPIRBB = new VPIRBasicBlock (IRBB );
868868 for (Instruction &I :
869- make_range (BB ->begin (), BB ->getTerminator ()->getIterator ()))
869+ make_range (IRBB ->begin (), IRBB ->getTerminator ()->getIterator ()))
870870 VPIRBB->appendRecipe (new VPIRInstruction (I));
871871 return VPIRBB;
872872}
@@ -875,7 +875,8 @@ VPlanPtr VPlan::createInitialVPlan(Type *InductionTy,
875875 PredicatedScalarEvolution &PSE,
876876 bool RequiresScalarEpilogueCheck,
877877 bool TailFolded, Loop *TheLoop) {
878- VPIRBasicBlock *Entry = createVPIRBasicBlockFor (TheLoop->getLoopPreheader ());
878+ VPIRBasicBlock *Entry =
879+ VPIRBasicBlock::fromBasicBlock (TheLoop->getLoopPreheader ());
879880 VPBasicBlock *VecPreheader = new VPBasicBlock (" vector.ph" );
880881 auto Plan = std::make_unique<VPlan>(Entry, VecPreheader);
881882
@@ -915,7 +916,7 @@ VPlanPtr VPlan::createInitialVPlan(Type *InductionTy,
915916 // we unconditionally branch to the scalar preheader. Do nothing.
916917 // 3) Otherwise, construct a runtime check.
917918 BasicBlock *IRExitBlock = TheLoop->getUniqueExitBlock ();
918- auto *VPExitBlock = createVPIRBasicBlockFor (IRExitBlock);
919+ auto *VPExitBlock = VPIRBasicBlock::fromBasicBlock (IRExitBlock);
919920 // The connection order corresponds to the operands of the conditional branch.
920921 VPBlockUtils::insertBlockAfter (VPExitBlock, MiddleVPBB);
921922 VPBlockUtils::connectBlocks (MiddleVPBB, ScalarPH);
@@ -991,7 +992,7 @@ void VPlan::prepareToExecute(Value *TripCountV, Value *VectorTripCountV,
991992// / have a single predecessor, which is rewired to the new VPIRBasicBlock. All
992993// / successors of VPBB, if any, are rewired to the new VPIRBasicBlock.
993994static void replaceVPBBWithIRVPBB (VPBasicBlock *VPBB, BasicBlock *IRBB) {
994- VPIRBasicBlock *IRVPBB = createVPIRBasicBlockFor (IRBB);
995+ VPIRBasicBlock *IRVPBB = VPIRBasicBlock::fromBasicBlock (IRBB);
995996 for (auto &R : make_early_inc_range (*VPBB)) {
996997 assert (!R.isPhi () && " Tried to move phi recipe to end of block" );
997998 R.moveBefore (*IRVPBB, IRVPBB->end ());
0 commit comments