@@ -347,11 +347,10 @@ updateSSA(SILModule &M, SILLoop *Loop,
347
347
}
348
348
349
349
// / Try to fully unroll the loop if we can determine the trip count and the trip
350
- // / count is below a threshold.
350
+ // / count lis below a threshold.
351
351
static bool tryToUnrollLoop (SILLoop *Loop) {
352
352
assert (Loop->getSubLoops ().empty () && " Expecting innermost loops" );
353
353
354
- LLVM_DEBUG (llvm::dbgs () << " Trying to unroll loop : \n " << *Loop);
355
354
auto *Preheader = Loop->getLoopPreheader ();
356
355
if (!Preheader)
357
356
return false ;
@@ -365,15 +364,11 @@ static bool tryToUnrollLoop(SILLoop *Loop) {
365
364
366
365
Optional<uint64_t > MaxTripCount =
367
366
getMaxLoopTripCount (Loop, Preheader, Header, Latch);
368
- if (!MaxTripCount) {
369
- LLVM_DEBUG (llvm::dbgs () << " Not unrolling, did not find trip count\n " );
367
+ if (!MaxTripCount)
370
368
return false ;
371
- }
372
369
373
- if (!canAndShouldUnrollLoop (Loop, MaxTripCount.getValue ())) {
374
- LLVM_DEBUG (llvm::dbgs () << " Not unrolling, exceeds cost threshold\n " );
370
+ if (!canAndShouldUnrollLoop (Loop, MaxTripCount.getValue ()))
375
371
return false ;
376
- }
377
372
378
373
// TODO: We need to split edges from non-condbr exits for the SSA updater. For
379
374
// now just don't handle loops containing such exits.
@@ -448,6 +443,7 @@ class LoopUnrolling : public SILFunctionTransform {
448
443
449
444
void run () override {
450
445
bool Changed = false ;
446
+
451
447
auto *Fun = getFunction ();
452
448
SILLoopInfo *LoopInfo = PM->getAnalysis <SILLoopAnalysis>()->get (Fun);
453
449
@@ -466,12 +462,6 @@ class LoopUnrolling : public SILFunctionTransform {
466
462
}
467
463
}
468
464
469
- if (InnermostLoops.empty ())
470
- return ;
471
-
472
- LLVM_DEBUG (llvm::dbgs () << " Loop Unroll running on function : "
473
- << Fun->getName () << " \n " );
474
-
475
465
// Try to unroll innermost loops.
476
466
for (auto *Loop : InnermostLoops)
477
467
Changed |= tryToUnrollLoop (Loop);
0 commit comments