[VPlan] Simplify code in createReplicateRegion (NFC).

Simplify the code as suggested in D143865.
This commit is contained in:
Florian Hahn
2023-03-11 11:46:38 +01:00
parent dd78e7334f
commit 2db71c9851

View File

@@ -8595,21 +8595,17 @@ VPRecipeBuilder::createReplicateRegion(VPReplicateRecipe *PredRecipe,
PredRecipe->getUnderlyingInstr(),
make_range(PredRecipe->op_begin(), std::prev(PredRecipe->op_end())),
PredRecipe->isUniform());
PredRecipe->replaceAllUsesWith(RecipeWithoutMask);
PredRecipe->eraseFromParent();
auto *BOMRecipe = new VPBranchOnMaskRecipe(BlockInMask);
auto *Entry = new VPBasicBlock(Twine(RegionName) + ".entry", BOMRecipe);
auto *PHIRecipe = RecipeWithoutMask->getNumUsers() == 0
? nullptr
: new VPPredInstPHIRecipe(RecipeWithoutMask);
if (PHIRecipe) {
RecipeWithoutMask->replaceAllUsesWith(PHIRecipe);
VPPredInstPHIRecipe *PHIRecipe = nullptr;
if (PredRecipe->getNumUsers() != 0) {
PHIRecipe = new VPPredInstPHIRecipe(RecipeWithoutMask);
PredRecipe->replaceAllUsesWith(PHIRecipe);
PHIRecipe->setOperand(0, RecipeWithoutMask);
}
PredRecipe->eraseFromParent();
auto *Exiting = new VPBasicBlock(Twine(RegionName) + ".continue", PHIRecipe);
auto *Pred = new VPBasicBlock(Twine(RegionName) + ".if", RecipeWithoutMask);
auto *BOMRecipe = new VPBranchOnMaskRecipe(BlockInMask);
auto *Entry = new VPBasicBlock(Twine(RegionName) + ".entry", BOMRecipe);
VPRegionBlock *Region = new VPRegionBlock(Entry, Exiting, RegionName, true);
// Note: first set Entry as region entry and then connect successors starting