Skip to content

Commit 160c5c8

Browse files
authored
Merge pull request swiftlang#35476 from apple/revert-35423-loopunrollossa
Revert "[NFC] Add tests for LoopUnroll on OSSA"
2 parents d36fae5 + 16d6144 commit 160c5c8

File tree

2 files changed

+4
-715
lines changed

2 files changed

+4
-715
lines changed

lib/SILOptimizer/LoopTransforms/LoopUnroll.cpp

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -347,11 +347,10 @@ updateSSA(SILModule &M, SILLoop *Loop,
347347
}
348348

349349
/// 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.
351351
static bool tryToUnrollLoop(SILLoop *Loop) {
352352
assert(Loop->getSubLoops().empty() && "Expecting innermost loops");
353353

354-
LLVM_DEBUG(llvm::dbgs() << "Trying to unroll loop : \n" << *Loop);
355354
auto *Preheader = Loop->getLoopPreheader();
356355
if (!Preheader)
357356
return false;
@@ -365,15 +364,11 @@ static bool tryToUnrollLoop(SILLoop *Loop) {
365364

366365
Optional<uint64_t> MaxTripCount =
367366
getMaxLoopTripCount(Loop, Preheader, Header, Latch);
368-
if (!MaxTripCount) {
369-
LLVM_DEBUG(llvm::dbgs() << "Not unrolling, did not find trip count\n");
367+
if (!MaxTripCount)
370368
return false;
371-
}
372369

373-
if (!canAndShouldUnrollLoop(Loop, MaxTripCount.getValue())) {
374-
LLVM_DEBUG(llvm::dbgs() << "Not unrolling, exceeds cost threshold\n");
370+
if (!canAndShouldUnrollLoop(Loop, MaxTripCount.getValue()))
375371
return false;
376-
}
377372

378373
// TODO: We need to split edges from non-condbr exits for the SSA updater. For
379374
// now just don't handle loops containing such exits.
@@ -448,6 +443,7 @@ class LoopUnrolling : public SILFunctionTransform {
448443

449444
void run() override {
450445
bool Changed = false;
446+
451447
auto *Fun = getFunction();
452448
SILLoopInfo *LoopInfo = PM->getAnalysis<SILLoopAnalysis>()->get(Fun);
453449

@@ -466,12 +462,6 @@ class LoopUnrolling : public SILFunctionTransform {
466462
}
467463
}
468464

469-
if (InnermostLoops.empty())
470-
return;
471-
472-
LLVM_DEBUG(llvm::dbgs() << "Loop Unroll running on function : "
473-
<< Fun->getName() << "\n");
474-
475465
// Try to unroll innermost loops.
476466
for (auto *Loop : InnermostLoops)
477467
Changed |= tryToUnrollLoop(Loop);

0 commit comments

Comments
 (0)