aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2025-05-30 08:33:14 +0100
committerFlorian Hahn <flo@fhahn.com>2025-05-30 08:33:15 +0100
commit417e43ad43d706c8a932adf702a55de97e65fb37 (patch)
tree858f1e0485a2d7dcadb2d97fa66cf6e8e8c87f0d
parentc7b8d6e1dcb0a277f95496cbc6bb27143afb80a6 (diff)
downloadllvm-417e43ad43d706c8a932adf702a55de97e65fb37.zip
llvm-417e43ad43d706c8a932adf702a55de97e65fb37.tar.gz
llvm-417e43ad43d706c8a932adf702a55de97e65fb37.tar.bz2
[LV] Set PhiTy once in adjustRecipesForReductions (NFC).
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorize.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 90e224e..6954a5f 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -9445,6 +9445,7 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
continue;
const RecurrenceDescriptor &RdxDesc = PhiR->getRecurrenceDescriptor();
+ Type *PhiTy = PhiR->getOperand(0)->getLiveInIRValue()->getType();
// If tail is folded by masking, introduce selects between the phi
// and the users outside the vector region of each reduction, at the
// beginning of the dedicated latch block.
@@ -9456,7 +9457,6 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
if (!PhiR->isInLoop() && CM.foldTailByMasking() &&
!isa<VPPartialReductionRecipe>(OrigExitingVPV->getDefiningRecipe())) {
VPValue *Cond = RecipeBuilder.getBlockInMask(PhiR->getParent());
- Type *PhiTy = PhiR->getOperand(0)->getLiveInIRValue()->getType();
std::optional<FastMathFlags> FMFs =
PhiTy->isFloatingPointTy()
? std::make_optional(RdxDesc.getFastMathFlags())
@@ -9477,7 +9477,6 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
// If the vector reduction can be performed in a smaller type, we truncate
// then extend the loop exit value to enable InstCombine to evaluate the
// entire expression in the smaller type.
- Type *PhiTy = PhiR->getStartValue()->getLiveInIRValue()->getType();
if (MinVF.isVector() && PhiTy != RdxDesc.getRecurrenceType() &&
!RecurrenceDescriptor::isAnyOfRecurrenceKind(
RdxDesc.getRecurrenceKind())) {