Skip to content

Commit 417e43a

Browse files
committed
[LV] Set PhiTy once in adjustRecipesForReductions (NFC).
1 parent c7b8d6e commit 417e43a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9445,6 +9445,7 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
94459445
continue;
94469446

94479447
const RecurrenceDescriptor &RdxDesc = PhiR->getRecurrenceDescriptor();
9448+
Type *PhiTy = PhiR->getOperand(0)->getLiveInIRValue()->getType();
94489449
// If tail is folded by masking, introduce selects between the phi
94499450
// and the users outside the vector region of each reduction, at the
94509451
// beginning of the dedicated latch block.
@@ -9456,7 +9457,6 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
94569457
if (!PhiR->isInLoop() && CM.foldTailByMasking() &&
94579458
!isa<VPPartialReductionRecipe>(OrigExitingVPV->getDefiningRecipe())) {
94589459
VPValue *Cond = RecipeBuilder.getBlockInMask(PhiR->getParent());
9459-
Type *PhiTy = PhiR->getOperand(0)->getLiveInIRValue()->getType();
94609460
std::optional<FastMathFlags> FMFs =
94619461
PhiTy->isFloatingPointTy()
94629462
? std::make_optional(RdxDesc.getFastMathFlags())
@@ -9477,7 +9477,6 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
94779477
// If the vector reduction can be performed in a smaller type, we truncate
94789478
// then extend the loop exit value to enable InstCombine to evaluate the
94799479
// entire expression in the smaller type.
9480-
Type *PhiTy = PhiR->getStartValue()->getLiveInIRValue()->getType();
94819480
if (MinVF.isVector() && PhiTy != RdxDesc.getRecurrenceType() &&
94829481
!RecurrenceDescriptor::isAnyOfRecurrenceKind(
94839482
RdxDesc.getRecurrenceKind())) {

0 commit comments

Comments
 (0)