Skip to content

Commit cba8b59

Browse files
committed
!fixup use pattern matching in a few more cases.
1 parent 0c3c293 commit cba8b59

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
@@ -3855,22 +3855,23 @@ bool isHeaderMask(const VPValue *V, VPlan &Plan);
38553855
/// if it is either defined outside the vector region or its operand is known to
38563856
/// be uniform across all VFs and UFs (e.g. VPDerivedIV or VPCanonicalIVPHI).
38573857
inline bool isUniformAcrossVFsAndUFs(VPValue *V) {
3858-
if (auto *VPI = dyn_cast_or_null<VPInstruction>(V->getDefiningRecipe())) {
3859-
return VPI ==
3860-
VPI->getParent()->getPlan()->getCanonicalIV()->getBackedgeValue();
3861-
}
3858+
if (V->isLiveIn())
3859+
return true;
38623860
if (isa<VPCanonicalIVPHIRecipe, VPDerivedIVRecipe, VPExpandSCEVRecipe>(V))
38633861
return true;
3862+
auto *R = cast<VPSingleDefRecipe>(V->getDefiningRecipe());
3863+
if (R == R->getParent()->getPlan()->getCanonicalIV()->getBackedgeValue())
3864+
return true;
38643865
if (isa<VPReplicateRecipe>(V) && cast<VPReplicateRecipe>(V)->isUniform() &&
38653866
(isa<LoadInst, StoreInst>(V->getUnderlyingValue())) &&
38663867
all_of(V->getDefiningRecipe()->operands(),
38673868
[](VPValue *Op) { return Op->isDefinedOutsideVectorRegions(); }))
38683869
return true;
38693870

3870-
auto *C = dyn_cast_or_null<VPScalarCastRecipe>(V->getDefiningRecipe());
3871-
return C && (C->isDefinedOutsideVectorRegions() ||
3872-
isa<VPDerivedIVRecipe>(C->getOperand(0)) ||
3873-
isa<VPCanonicalIVPHIRecipe>(C->getOperand(0)));
3871+
return isa<VPScalarCastRecipe, VPWidenCastRecipe>(R) &&
3872+
(R->isDefinedOutsideVectorRegions() || R->getOperand(0)->isLiveIn() ||
3873+
isa<VPDerivedIVRecipe>(R->getOperand(0)) ||
3874+
isa<VPCanonicalIVPHIRecipe>(R->getOperand(0)));
38743875
}
38753876

38763877
} // end namespace vputils

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,6 @@ void VPWidenIntOrFpInductionRecipe::execute(VPTransformState &State) {
13151315
// Need to create stuff in PH.
13161316
SplatVF = State.get(getOperand(2), 0);
13171317
} else {
1318-
13191318
// Multiply the vectorization factor by the step using integer or
13201319
// floating-point arithmetic as appropriate.
13211320
Type *StepType = Step->getType();

0 commit comments

Comments
 (0)