[llvm] b72bbfc - [VPlan] Remove fixHeaderPhis (NFC).
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 23 02:53:56 PST 2025
Author: Florian Hahn
Date: 2025-02-23T10:51:20Z
New Revision: b72bbfc293f40380f08198ef344f032126e838e1
URL: https://github.com/llvm/llvm-project/commit/b72bbfc293f40380f08198ef344f032126e838e1
DIFF: https://github.com/llvm/llvm-project/commit/b72bbfc293f40380f08198ef344f032126e838e1.diff
LOG: [VPlan] Remove fixHeaderPhis (NFC).
Removes unneeded code after https://github.com/llvm/llvm-project/pull/124432.
Added:
Modified:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 7b346bfd67c0d..ced01df7b0d44 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -8675,16 +8675,6 @@ VPRecipeBuilder::tryToWidenHistogram(const HistogramInfo *HI,
HI->Store->getDebugLoc());
}
-void VPRecipeBuilder::fixHeaderPhis() {
- BasicBlock *OrigLatch = OrigLoop->getLoopLatch();
- for (VPHeaderPHIRecipe *R : PhisToFix) {
- auto *PN = cast<PHINode>(R->getUnderlyingValue());
- VPRecipeBase *IncR =
- getRecipe(cast<Instruction>(PN->getIncomingValueForBlock(OrigLatch)));
- R->addOperand(IncR->getVPSingleValue());
- }
-}
-
VPReplicateRecipe *
VPRecipeBuilder::handleReplication(Instruction *I, ArrayRef<VPValue *> Operands,
VFRange &Range) {
@@ -8870,6 +8860,7 @@ VPRecipeBase *VPRecipeBuilder::tryToCreateWidenRecipe(
if (Phi->getParent() != OrigLoop->getHeader())
return tryToBlend(Phi, Operands);
+ assert(Operands.size() == 2 && "Must have 2 operands for header phis");
if ((Recipe = tryToOptimizeInductionPHI(Phi, Operands, Range)))
return Recipe;
@@ -8897,8 +8888,8 @@ VPRecipeBase *VPRecipeBuilder::tryToCreateWidenRecipe(
// directly, enabling more efficient codegen.
PhiRecipe = new VPFirstOrderRecurrencePHIRecipe(Phi, *StartV);
}
-
- PhisToFix.push_back(PhiRecipe);
+ // Add backedge value.
+ PhiRecipe->addOperand(Operands[1]);
return PhiRecipe;
}
@@ -9500,7 +9491,6 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range) {
!Plan->getVectorLoopRegion()->getEntryBasicBlock()->empty() &&
"entry block must be set to a VPRegionBlock having a non-empty entry "
"VPBasicBlock");
- RecipeBuilder.fixHeaderPhis();
// Update wide induction increments to use the same step as the corresponding
// wide induction. This enables detecting induction increments directly in
diff --git a/llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h b/llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h
index 756cbf4d36d7d..334cfbad8bd7c 100644
--- a/llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h
+++ b/llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h
@@ -225,10 +225,6 @@ class VPRecipeBuilder {
ArrayRef<VPValue *> Operands,
VFRange &Range);
- /// Add the incoming values from the backedge to reduction & first-order
- /// recurrence cross-iteration phis.
- void fixHeaderPhis();
-
VPValue *getVPValueOrAddLiveIn(Value *V) {
if (auto *I = dyn_cast<Instruction>(V)) {
if (auto *R = Ingredient2Recipe.lookup(I))
More information about the llvm-commits
mailing list