@@ -3855,22 +3855,23 @@ bool isHeaderMask(const VPValue *V, VPlan &Plan);
3855
3855
// / if it is either defined outside the vector region or its operand is known to
3856
3856
// / be uniform across all VFs and UFs (e.g. VPDerivedIV or VPCanonicalIVPHI).
3857
3857
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 ;
3862
3860
if (isa<VPCanonicalIVPHIRecipe, VPDerivedIVRecipe, VPExpandSCEVRecipe>(V))
3863
3861
return true ;
3862
+ auto *R = cast<VPSingleDefRecipe>(V->getDefiningRecipe ());
3863
+ if (R == R->getParent ()->getPlan ()->getCanonicalIV ()->getBackedgeValue ())
3864
+ return true ;
3864
3865
if (isa<VPReplicateRecipe>(V) && cast<VPReplicateRecipe>(V)->isUniform () &&
3865
3866
(isa<LoadInst, StoreInst>(V->getUnderlyingValue ())) &&
3866
3867
all_of (V->getDefiningRecipe ()->operands (),
3867
3868
[](VPValue *Op) { return Op->isDefinedOutsideVectorRegions (); }))
3868
3869
return true ;
3869
3870
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 )));
3874
3875
}
3875
3876
3876
3877
} // end namespace vputils
0 commit comments