@@ -1364,36 +1364,33 @@ class LoopVectorizationCostModel {
1364
1364
return ;
1365
1365
}
1366
1366
1367
- if (!ForceTailFoldingStyle.getNumOccurrences ()) {
1368
- ChosenTailFoldingStyle = {
1369
- TTI.getPreferredTailFoldingStyle (/* IVUpdateMayOverflow=*/ true ),
1370
- TTI.getPreferredTailFoldingStyle (/* IVUpdateMayOverflow=*/ false )};
1371
- return ;
1372
- }
1367
+ // Default to TTI preference, but allow command line override.
1368
+ ChosenTailFoldingStyle = {
1369
+ TTI.getPreferredTailFoldingStyle (/* IVUpdateMayOverflow=*/ true ),
1370
+ TTI.getPreferredTailFoldingStyle (/* IVUpdateMayOverflow=*/ false )};
1371
+ if (ForceTailFoldingStyle.getNumOccurrences ())
1372
+ ChosenTailFoldingStyle = {ForceTailFoldingStyle.getValue (),
1373
+ ForceTailFoldingStyle.getValue ()};
1373
1374
1374
- // Set styles when forced.
1375
- ChosenTailFoldingStyle = {ForceTailFoldingStyle.getValue (),
1376
- ForceTailFoldingStyle.getValue ()};
1377
1375
if (ForceTailFoldingStyle != TailFoldingStyle::DataWithEVL)
1378
1376
return ;
1379
1377
// Override forced styles if needed.
1380
1378
// FIXME: Investigate opportunity for fixed vector factor.
1381
1379
bool EVLIsLegal = UserIC <= 1 && IsScalableVF &&
1382
1380
TTI.hasActiveVectorLength () && !EnableVPlanNativePath;
1383
- if (!EVLIsLegal) {
1384
- // If for some reason EVL mode is unsupported, fallback to
1385
- // DataWithoutLaneMask to try to vectorize the loop with folded tail
1386
- // in a generic way.
1387
- ChosenTailFoldingStyle = {TailFoldingStyle::DataWithoutLaneMask,
1388
- TailFoldingStyle::DataWithoutLaneMask};
1389
- LLVM_DEBUG (
1390
- dbgs ()
1391
- << " LV: Preference for VP intrinsics indicated. Will "
1392
- " not try to generate VP Intrinsics "
1393
- << (UserIC > 1
1394
- ? " since interleave count specified is greater than 1.\n "
1395
- : " due to non-interleaving reasons.\n " ));
1396
- }
1381
+ if (EVLIsLegal)
1382
+ return ;
1383
+ // If for some reason EVL mode is unsupported, fallback to
1384
+ // DataWithoutLaneMask to try to vectorize the loop with folded tail
1385
+ // in a generic way.
1386
+ ChosenTailFoldingStyle = {TailFoldingStyle::DataWithoutLaneMask,
1387
+ TailFoldingStyle::DataWithoutLaneMask};
1388
+ LLVM_DEBUG (
1389
+ dbgs () << " LV: Preference for VP intrinsics indicated. Will "
1390
+ " not try to generate VP Intrinsics "
1391
+ << (UserIC > 1
1392
+ ? " since interleave count specified is greater than 1.\n "
1393
+ : " due to non-interleaving reasons.\n " ));
1397
1394
}
1398
1395
1399
1396
// / Returns true if all loop blocks should be masked to fold tail loop.
0 commit comments