File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
llvm/lib/Transforms/Vectorize Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -9190,7 +9190,12 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range) {
9190
9190
auto *CI = Plan->getOrAddLiveIn (
9191
9191
ConstantInt::get (Stride->getType (), ScevStride->getAPInt ()));
9192
9192
if (VPValue *StrideVPV = Plan->getLiveIn (StrideV))
9193
- StrideVPV->replaceAllUsesWith (CI);
9193
+ StrideVPV->replaceUsesWithIf (CI, [&Plan](VPUser &U, unsigned ) {
9194
+ auto *R = dyn_cast<VPRecipeBase>(&U);
9195
+ if (!R)
9196
+ return false ;
9197
+ return R->getParent ()->getParent () || R->getParent () == Plan->getVectorLoopRegion ()->getSinglePredecessor ();
9198
+ });
9194
9199
9195
9200
// The versioned value may not be used in the loop directly but through a
9196
9201
// sext/zext. Add new live-ins in those cases.
@@ -9204,7 +9209,12 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range) {
9204
9209
APInt C = isa<SExtInst>(U) ? ScevStride->getAPInt ().sext (BW)
9205
9210
: ScevStride->getAPInt ().zext (BW);
9206
9211
VPValue *CI = Plan->getOrAddLiveIn (ConstantInt::get (U->getType (), C));
9207
- StrideVPV->replaceAllUsesWith (CI);
9212
+ StrideVPV->replaceUsesWithIf (CI, [&Plan](VPUser &U, unsigned ) {
9213
+ auto *R = dyn_cast<VPRecipeBase>(&U);
9214
+ if (!R)
9215
+ return false ;
9216
+ return R->getParent ()->getParent () || R->getParent () == Plan->getVectorLoopRegion ()->getSinglePredecessor ();
9217
+ });
9208
9218
}
9209
9219
}
9210
9220
You can’t perform that action at this time.
0 commit comments