File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
llvm/lib/Transforms/Vectorize Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -3236,11 +3236,9 @@ bool LoopVectorizationCostModel::isScalarWithPredication(
3236
3236
3237
3237
// TODO: Fold into LoopVectorizationLegality::isMaskRequired.
3238
3238
bool LoopVectorizationCostModel::isPredicatedInst (Instruction *I) const {
3239
- // If predication is not needed, avoid it.
3240
3239
// TODO: We can use the loop-preheader as context point here and get
3241
3240
// context sensitive reasoning for isSafeToSpeculativelyExecute.
3242
- if (!blockNeedsPredicationForAnyReason (I->getParent ()) ||
3243
- isSafeToSpeculativelyExecute (I) ||
3241
+ if (isSafeToSpeculativelyExecute (I) ||
3244
3242
(isa<LoadInst, StoreInst, CallInst>(I) && !Legal->isMaskRequired (I)) ||
3245
3243
isa<BranchInst, SwitchInst, PHINode, AllocaInst>(I))
3246
3244
return false ;
@@ -3250,6 +3248,10 @@ bool LoopVectorizationCostModel::isPredicatedInst(Instruction *I) const {
3250
3248
if (Legal->blockNeedsPredication (I->getParent ()))
3251
3249
return true ;
3252
3250
3251
+ // If we're not folding the tail by masking, predication is unnecessary.
3252
+ if (!foldTailByMasking ())
3253
+ return false ;
3254
+
3253
3255
// All that remain are instructions with side-effects originally executed in
3254
3256
// the loop unconditionally, but now execute under a tail-fold mask (only)
3255
3257
// having at least one active lane (the first). If the side-effects of the
You can’t perform that action at this time.
0 commit comments