@@ -175,6 +175,8 @@ const char LLVMLoopVectorizeFollowupEpilogue[] =
175
175
STATISTIC (LoopsVectorized, " Number of loops vectorized" );
176
176
STATISTIC (LoopsAnalyzed, " Number of loops analyzed for vectorization" );
177
177
STATISTIC (LoopsEpilogueVectorized, " Number of epilogues vectorized" );
178
+ STATISTIC (LoopsEarlyExitVectorized, " Number of early exit loops vectorized" );
179
+
178
180
179
181
static cl::opt<bool > EnableEpilogueVectorization (
180
182
" enable-epilogue-vectorization" , cl::init(true ), cl::Hidden,
@@ -10291,6 +10293,9 @@ bool LoopVectorizePass::processLoop(Loop *L) {
10291
10293
auto ExpandedSCEVs = LVP.executePlan (EPI.MainLoopVF , EPI.MainLoopUF ,
10292
10294
*BestMainPlan, MainILV, DT, false );
10293
10295
++LoopsVectorized;
10296
+ // TODO: Currently unsupported for early exits.
10297
+ if (BestPlan.hasEarlyExit ())
10298
+ ++LoopsEarlyExitVectorized;
10294
10299
10295
10300
// Second pass vectorizes the epilogue and adjusts the control flow
10296
10301
// edges from the first pass.
@@ -10319,6 +10324,10 @@ bool LoopVectorizePass::processLoop(Loop *L) {
10319
10324
Inc->setIncomingValueForBlock (BypassBlock, V);
10320
10325
}
10321
10326
++LoopsEpilogueVectorized;
10327
+ // TODO: Currently unsupported for early exits.
10328
+ if (BestEpiPlan.hasEarlyExit ())
10329
+ ++LoopsEarlyExitVectorized;
10330
+
10322
10331
10323
10332
if (!Checks.hasChecks ())
10324
10333
DisableRuntimeUnroll = true ;
@@ -10328,6 +10337,8 @@ bool LoopVectorizePass::processLoop(Loop *L) {
10328
10337
Checks, BestPlan);
10329
10338
LVP.executePlan (VF.Width , IC, BestPlan, LB, DT, false );
10330
10339
++LoopsVectorized;
10340
+ if (BestPlan.hasEarlyExit ())
10341
+ ++LoopsEarlyExitVectorized;
10331
10342
10332
10343
// Add metadata to disable runtime unrolling a scalar loop when there
10333
10344
// are no runtime checks about strides and memory. A scalar loop that is
0 commit comments