Skip to content

Commit 64b32fe

Browse files
committed
!fixup update to main, use more verbose naming, simplify code a bit
1 parent 2ec3be6 commit 64b32fe

File tree

7 files changed

+14
-20
lines changed

7 files changed

+14
-20
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8982,12 +8982,8 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
89828982
U->replaceUsesOfWith(OrigExitingVPV, FinalReductionResult);
89838983

89848984
// Look through ExtractLastPart.
8985-
if (match(U, m_ExtractLastPart(m_VPValue()))) {
8986-
auto *ExtractPart = cast<VPInstruction>(U);
8987-
if (ExtractPart->getNumUsers() != 1)
8988-
continue;
8989-
U = *ExtractPart->user_begin();
8990-
}
8985+
if (match(U, m_ExtractLastPart(m_VPValue())))
8986+
U = cast<VPInstruction>(U)->getSingleUser();
89918987

89928988
if (match(U, m_CombineOr(m_ExtractLane(m_VPValue(), m_VPValue()),
89938989
m_ExtractLastLane(m_VPValue()))))

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,10 +1464,10 @@ class VPIRInstruction : public VPRecipeBase {
14641464
return true;
14651465
}
14661466

1467-
/// Update the recipe's first operand to the final lane of the operand using
1468-
/// \p Builder. Must only be used for VPIRInstructions with at least one
1469-
/// operand wrapping a PHINode.
1470-
void extractFinalLaneOfFirstOperand(VPBuilder &Builder);
1467+
/// Update the recipe's first operand to the last lane of the last part of the
1468+
/// operand using \p Builder. Must only be used for VPIRInstructions with at
1469+
/// least one operand wrapping a PHINode.
1470+
void extractLastLaneOfLastPartOfFirstOperand(VPBuilder &Builder);
14711471

14721472
protected:
14731473
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)

llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,8 @@ Type *VPTypeAnalysis::inferScalarTypeForRecipe(const VPInstruction *R) {
126126
return VecTy->getElementType();
127127
return BaseTy;
128128
}
129-
case VPInstruction::ExtractLastPart: {
130-
// Element type of ExtractLastPart is equal to the element type of its
131-
// operand.
129+
case VPInstruction::ExtractLastPart:
132130
return inferScalarType(R->getOperand(0));
133-
}
134131
case VPInstruction::LogicalAnd:
135132
assert(inferScalarType(R->getOperand(0))->isIntegerTy(1) &&
136133
inferScalarType(R->getOperand(1))->isIntegerTy(1) &&

llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ template <typename Op0_t>
414414
inline VPInstruction_match<
415415
VPInstruction::ExtractLastLane,
416416
VPInstruction_match<VPInstruction::ExtractLastPart, Op0_t>>
417-
m_ExtractFinalLane(const Op0_t &Op0) {
417+
m_ExtractLastLaneOfLastPart(const Op0_t &Op0) {
418418
return m_ExtractLastLane(m_ExtractLastPart(Op0));
419419
}
420420

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1497,7 +1497,8 @@ InstructionCost VPIRInstruction::computeCost(ElementCount VF,
14971497
return 0;
14981498
}
14991499

1500-
void VPIRInstruction::extractFinalLaneOfFirstOperand(VPBuilder &Builder) {
1500+
void VPIRInstruction::extractLastLaneOfLastPartOfFirstOperand(
1501+
VPBuilder &Builder) {
15011502
assert(isa<PHINode>(getInstruction()) &&
15021503
"can only update exiting operands to phi nodes");
15031504
assert(getNumOperands() > 0 && "must have at least one operand");

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ static VPValue *optimizeLatchExitInductionUser(
946946
VPlan &Plan, VPTypeAnalysis &TypeInfo, VPBlockBase *PredVPBB, VPValue *Op,
947947
DenseMap<VPValue *, VPValue *> &EndValues, ScalarEvolution &SE) {
948948
VPValue *Incoming;
949-
if (!match(Op, m_ExtractFinalLane(m_VPValue(Incoming))))
949+
if (!match(Op, m_ExtractLastLaneOfLastPart(m_VPValue(Incoming))))
950950
return nullptr;
951951

952952
auto *WideIV = getOptimizableIVOf(Incoming, SE);
@@ -3764,7 +3764,7 @@ void VPlanTransforms::handleUncountableEarlyExit(VPBasicBlock *EarlyExitingVPBB,
37643764
if (ExitIRI->getNumOperands() != 1) {
37653765
// The first of two operands corresponds to the latch exit, via MiddleVPBB
37663766
// predecessor. Extract its final lane.
3767-
ExitIRI->extractFinalLaneOfFirstOperand(MiddleBuilder);
3767+
ExitIRI->extractLastLaneOfLastPartOfFirstOperand(MiddleBuilder);
37683768
}
37693769

37703770
VPValue *IncomingFromEarlyExit = ExitIRI->getOperand(EarlyExitIdx);
@@ -5093,7 +5093,7 @@ void VPlanTransforms::addExitUsersForFirstOrderRecurrences(VPlan &Plan,
50935093
// the VPIRInstruction modeling the phi.
50945094
for (VPRecipeBase &R : make_early_inc_range(
50955095
make_range(MiddleVPBB->getFirstNonPhi(), MiddleVPBB->end()))) {
5096-
if (!match(&R, m_ExtractFinalLane(m_Specific(FOR))))
5096+
if (!match(&R, m_ExtractLastLaneOfLastPart(m_Specific(FOR))))
50975097
continue;
50985098

50995099
// For VF vscale x 1, if vscale = 1, we are unable to extract the

llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ void UnrollState::unrollBlock(VPBlockBase *VPB) {
371371
continue;
372372
}
373373

374-
if (match(&R, m_ExtractFinalLane(m_VPValue(Op0))) ||
374+
if (match(&R, m_ExtractLastLaneOfLastPart(m_VPValue(Op0))) ||
375375
match(&R, m_ExtractPenultimateElement(m_VPValue(Op0)))) {
376376
addUniformForAllParts(cast<VPSingleDefRecipe>(&R));
377377
if (Plan.hasScalarVFOnly()) {

0 commit comments

Comments
 (0)