Skip to content

Commit

Permalink
[LV] Use PredRecipe directly instead of getOrAddVPValue (NFC).
Browse files Browse the repository at this point in the history
There is no need to look up the VPValue for Instr, PredRecipe can be
used directly.
  • Loading branch information
fhahn committed Jul 14, 2022
1 parent b7f8314 commit 6f7347b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
7 changes: 3 additions & 4 deletions llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Expand Up @@ -8444,9 +8444,8 @@ VPBasicBlock *VPRecipeBuilder::handleReplication(
return RegSucc;
}

VPRegionBlock *VPRecipeBuilder::createReplicateRegion(Instruction *Instr,
VPRecipeBase *PredRecipe,
VPlanPtr &Plan) {
VPRegionBlock *VPRecipeBuilder::createReplicateRegion(
Instruction *Instr, VPReplicateRecipe *PredRecipe, VPlanPtr &Plan) {
// Instructions marked for predication are replicated and placed under an
// if-then construct to prevent side-effects.

Expand All @@ -8460,7 +8459,7 @@ VPRegionBlock *VPRecipeBuilder::createReplicateRegion(Instruction *Instr,
auto *Entry = new VPBasicBlock(Twine(RegionName) + ".entry", BOMRecipe);
auto *PHIRecipe = Instr->getType()->isVoidTy()
? nullptr
: new VPPredInstPHIRecipe(Plan->getOrAddVPValue(Instr));
: new VPPredInstPHIRecipe(PredRecipe);
if (PHIRecipe) {
Plan->removeVPValueFor(Instr);
Plan->addVPValue(Instr, PHIRecipe);
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h
Expand Up @@ -159,7 +159,8 @@ class VPRecipeBuilder {

/// Create a replicating region for instruction \p I that requires
/// predication. \p PredRecipe is a VPReplicateRecipe holding \p I.
VPRegionBlock *createReplicateRegion(Instruction *I, VPRecipeBase *PredRecipe,
VPRegionBlock *createReplicateRegion(Instruction *I,
VPReplicateRecipe *PredRecipe,
VPlanPtr &Plan);

/// Build a VPReplicationRecipe for \p I and enclose it within a Region if it
Expand Down

0 comments on commit 6f7347b

Please sign in to comment.