Skip to content

Commit c927070

Browse files
committed
!fixup use pattern matching in a few more cases.
1 parent ffab63b commit c927070

File tree

4 files changed

+116
-158
lines changed

4 files changed

+116
-158
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3698,22 +3698,23 @@ bool isHeaderMask(VPValue *V, VPlan &Plan);
36983698
/// if it is either defined outside the vector region or its operand is known to
36993699
/// be uniform across all VFs and UFs (e.g. VPDerivedIV or VPCanonicalIVPHI).
37003700
inline bool isUniformAcrossVFsAndUFs(VPValue *V) {
3701-
if (auto *VPI = dyn_cast_or_null<VPInstruction>(V->getDefiningRecipe())) {
3702-
return VPI ==
3703-
VPI->getParent()->getPlan()->getCanonicalIV()->getBackedgeValue();
3704-
}
3701+
if (V->isLiveIn())
3702+
return true;
37053703
if (isa<VPCanonicalIVPHIRecipe, VPDerivedIVRecipe, VPExpandSCEVRecipe>(V))
37063704
return true;
3705+
auto *R = cast<VPSingleDefRecipe>(V->getDefiningRecipe());
3706+
if (R == R->getParent()->getPlan()->getCanonicalIV()->getBackedgeValue())
3707+
return true;
37073708
if (isa<VPReplicateRecipe>(V) && cast<VPReplicateRecipe>(V)->isUniform() &&
37083709
(isa<LoadInst, StoreInst>(V->getUnderlyingValue())) &&
37093710
all_of(V->getDefiningRecipe()->operands(),
37103711
[](VPValue *Op) { return Op->isDefinedOutsideVectorRegions(); }))
37113712
return true;
37123713

3713-
auto *C = dyn_cast_or_null<VPScalarCastRecipe>(V->getDefiningRecipe());
3714-
return C && (C->isDefinedOutsideVectorRegions() ||
3715-
isa<VPDerivedIVRecipe>(C->getOperand(0)) ||
3716-
isa<VPCanonicalIVPHIRecipe>(C->getOperand(0)));
3714+
return isa<VPScalarCastRecipe, VPWidenCastRecipe>(R) &&
3715+
(R->isDefinedOutsideVectorRegions() || R->getOperand(0)->isLiveIn() ||
3716+
isa<VPDerivedIVRecipe>(R->getOperand(0)) ||
3717+
isa<VPCanonicalIVPHIRecipe>(R->getOperand(0)));
37173718
}
37183719

37193720
} // end namespace vputils

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1226,7 +1226,6 @@ void VPWidenIntOrFpInductionRecipe::execute(VPTransformState &State) {
12261226
// Need to create stuff in PH.
12271227
SplatVF = State.get(getOperand(2), 0);
12281228
} else {
1229-
12301229
// Multiply the vectorization factor by the step using integer or
12311230
// floating-point arithmetic as appropriate.
12321231
Type *StepType = Step->getType();

0 commit comments

Comments
 (0)