diff options
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp')
-rw-r--r-- | llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp index 3f6a2efd55ccb..3a4872a721221 100644 --- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp @@ -18,7 +18,7 @@ using namespace llvm; void VPlanTransforms::VPInstructionsToVPRecipes( Loop *OrigLoop, VPlanPtr &Plan, - LoopVectorizationLegality::InductionList *Inductions, + LoopVectorizationLegality::InductionList &Inductions, SmallPtrSetImpl<Instruction *> &DeadInstructions) { auto *TopRegion = cast<VPRegionBlock>(Plan->getEntry()); @@ -41,7 +41,6 @@ void VPlanTransforms::VPInstructionsToVPRecipes( continue; VPBasicBlock *VPBB = Base->getEntryBasicBlock(); - VPRecipeBase *LastRecipe = nullptr; // Introduce each ingredient into VPlan. for (auto I = VPBB->begin(), E = VPBB->end(); I != E;) { VPRecipeBase *Ingredient = &*I++; @@ -55,33 +54,29 @@ void VPlanTransforms::VPInstructionsToVPRecipes( VPRecipeBase *NewRecipe = nullptr; // Create VPWidenMemoryInstructionRecipe for loads and stores. - if (isa<LoadInst>(Inst) || isa<StoreInst>(Inst)) + if (LoadInst *Load = dyn_cast<LoadInst>(Inst)) NewRecipe = new VPWidenMemoryInstructionRecipe( - *Inst, Plan->getOrAddVPValue(getLoadStorePointerOperand(Inst)), + *Load, Plan->getOrAddVPValue(getLoadStorePointerOperand(Inst)), nullptr /*Mask*/); + else if (StoreInst *Store = dyn_cast<StoreInst>(Inst)) + NewRecipe = new VPWidenMemoryInstructionRecipe( + *Store, Plan->getOrAddVPValue(getLoadStorePointerOperand(Inst)), + Plan->getOrAddVPValue(Store->getValueOperand()), nullptr /*Mask*/); else if (PHINode *Phi = dyn_cast<PHINode>(Inst)) { - InductionDescriptor II = Inductions->lookup(Phi); + InductionDescriptor II = Inductions.lookup(Phi); if (II.getKind() == InductionDescriptor::IK_IntInduction || II.getKind() == InductionDescriptor::IK_FpInduction) { NewRecipe = new VPWidenIntOrFpInductionRecipe(Phi); } else NewRecipe = new VPWidenPHIRecipe(Phi); } else if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(Inst)) { - NewRecipe = new VPWidenGEPRecipe(GEP, OrigLoop); - } else { - // If the last recipe is a VPWidenRecipe, add Inst to it instead of - // creating a new recipe. - if (VPWidenRecipe *WidenRecipe = - dyn_cast_or_null<VPWidenRecipe>(LastRecipe)) { - WidenRecipe->appendInstruction(Inst); - Ingredient->eraseFromParent(); - continue; - } - NewRecipe = new VPWidenRecipe(Inst); - } + NewRecipe = new VPWidenGEPRecipe( + GEP, Plan->mapToVPValues(GEP->operands()), OrigLoop); + } else + NewRecipe = + new VPWidenRecipe(*Inst, Plan->mapToVPValues(Inst->operands())); NewRecipe->insertBefore(Ingredient); - LastRecipe = NewRecipe; Ingredient->eraseFromParent(); } } |