Skip to content

Commit 8949101

Browse files
committed
!fixup use static cast, add helper.
1 parent ba96c7e commit 8949101

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,11 @@ class LoopVectorizationLegality {
301301
/// Returns the reduction variables found in the loop.
302302
const ReductionList &getReductionVars() const { return Reductions; }
303303

304+
RecurrenceDescriptor getRecurrenceDescriptor(PHINode *PN) const {
305+
assert(Reductions.contains(PN) && "no recurrence descriptor for phi");
306+
return Reductions.lookup(PN);
307+
}
308+
304309
/// Returns the induction variables found in the loop.
305310
const InductionList &getInductionVars() const { return Inductions; }
306311

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9173,7 +9173,7 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
91739173
if (CM.blockNeedsPredicationForAnyReason(CurrentLinkI->getParent()))
91749174
CondOp = RecipeBuilder.getBlockInMask(CurrentLink->getParent());
91759175

9176-
const RecurrenceDescriptor &RdxDesc = Legal->getReductionVars().lookup(
9176+
RecurrenceDescriptor RdxDesc = Legal->getRecurrenceDescriptor(
91779177
cast<PHINode>(PhiR->getUnderlyingInstr()));
91789178
// Non-FP RdxDescs will have all fast math flags set, so clear them.
91799179
FastMathFlags FMFs = isa<FPMathOperator>(CurrentLinkI)

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,8 +740,8 @@ Value *VPInstruction::generate(VPTransformState &State) {
740740
Value *ReducedPartRdx = State.get(getOperand(2));
741741
for (unsigned Idx = 3; Idx < getNumOperands(); ++Idx)
742742
ReducedPartRdx = Builder.CreateBinOp(
743-
(Instruction::BinaryOps)RecurrenceDescriptor::getOpcode(
744-
RecurKind::AnyOf),
743+
static_cast<Instruction::BinaryOps>(
744+
RecurrenceDescriptor::getOpcode(RecurKind::AnyOf)),
745745
State.get(getOperand(Idx)), ReducedPartRdx, "bin.rdx");
746746
return createAnyOfReduction(Builder, ReducedPartRdx,
747747
State.get(getOperand(1), VPLane(0)), OrigPhi);

0 commit comments

Comments
 (0)