NewLoopsMap &NewLoops);
/// Represents the result of a \c UnrollLoop invocation.
-enum class LoopUnrollStatus {
+enum class LoopUnrollResult {
/// The loop was not modified.
Unmodified,
FullyUnrolled
};
-LoopUnrollStatus UnrollLoop(Loop *L, unsigned Count, unsigned TripCount,
+LoopUnrollResult UnrollLoop(Loop *L, unsigned Count, unsigned TripCount,
bool Force, bool AllowRuntime,
bool AllowExpensiveTripCount, bool PreserveCondBr,
bool PreserveOnlyFirst, unsigned TripMultiple,
UP.Count = TripCount;
// Unroll the loop.
- LoopUnrollStatus UnrollStatus = UnrollLoop(
+ LoopUnrollResult UnrollStatus = UnrollLoop(
L, UP.Count, TripCount, UP.Force, UP.Runtime, UP.AllowExpensiveTripCount,
UseUpperBound, MaxOrZero, TripMultiple, UP.PeelCount, UP.UnrollRemainder,
LI, &SE, &DT, &AC, &ORE, PreserveLCSSA);
- if (UnrollStatus == LoopUnrollStatus::Unmodified)
+ if (UnrollStatus == LoopUnrollResult::Unmodified)
return false;
// If loop has an unroll count pragma or unrolled by explicitly set count
// mark loop as unrolled to prevent unrolling beyond that requested.
// If the loop was peeled, we already "used up" the profile information
// we had, so we don't want to unroll or peel again.
- if (UnrollStatus != LoopUnrollStatus::FullyUnrolled &&
+ if (UnrollStatus != LoopUnrollResult::FullyUnrolled &&
(IsCountSetExplicitly || UP.PeelCount))
SetLoopAlreadyUnrolled(L);
///
/// This utility preserves LoopInfo. It will also preserve ScalarEvolution and
/// DominatorTree if they are non-null.
-LoopUnrollStatus llvm::UnrollLoop(
+LoopUnrollResult llvm::UnrollLoop(
Loop *L, unsigned Count, unsigned TripCount, bool Force, bool AllowRuntime,
bool AllowExpensiveTripCount, bool PreserveCondBr, bool PreserveOnlyFirst,
unsigned TripMultiple, unsigned PeelCount, bool UnrollRemainder,
BasicBlock *Preheader = L->getLoopPreheader();
if (!Preheader) {
DEBUG(dbgs() << " Can't unroll; loop preheader-insertion failed.\n");
- return LoopUnrollStatus::Unmodified;
+ return LoopUnrollResult::Unmodified;
}
BasicBlock *LatchBlock = L->getLoopLatch();
if (!LatchBlock) {
DEBUG(dbgs() << " Can't unroll; loop exit-block-insertion failed.\n");
- return LoopUnrollStatus::Unmodified;
+ return LoopUnrollResult::Unmodified;
}
// Loops with indirectbr cannot be cloned.
if (!L->isSafeToClone()) {
DEBUG(dbgs() << " Can't unroll; Loop body cannot be cloned.\n");
- return LoopUnrollStatus::Unmodified;
+ return LoopUnrollResult::Unmodified;
}
// The current loop unroll pass can only unroll loops with a single latch
// The loop-rotate pass can be helpful to avoid this in many cases.
DEBUG(dbgs() <<
" Can't unroll; loop not terminated by a conditional branch.\n");
- return LoopUnrollStatus::Unmodified;
+ return LoopUnrollResult::Unmodified;
}
auto CheckSuccessors = [&](unsigned S1, unsigned S2) {
if (!CheckSuccessors(0, 1) && !CheckSuccessors(1, 0)) {
DEBUG(dbgs() << "Can't unroll; only loops with one conditional latch"
" exiting the loop can be unrolled\n");
- return LoopUnrollStatus::Unmodified;
+ return LoopUnrollResult::Unmodified;
}
if (Header->hasAddressTaken()) {
// The loop-rotate pass can be helpful to avoid this in many cases.
DEBUG(dbgs() <<
" Won't unroll loop: address of header block is taken.\n");
- return LoopUnrollStatus::Unmodified;
+ return LoopUnrollResult::Unmodified;
}
if (TripCount != 0)
// Don't enter the unroll code if there is nothing to do.
if (TripCount == 0 && Count < 2 && PeelCount == 0) {
DEBUG(dbgs() << "Won't unroll; almost nothing to do\n");
- return LoopUnrollStatus::Unmodified;
+ return LoopUnrollResult::Unmodified;
}
assert(Count > 0);
DEBUG(
dbgs() << "Wont unroll; remainder loop could not be generated"
"when assuming runtime trip count\n");
- return LoopUnrollStatus::Unmodified;
+ return LoopUnrollResult::Unmodified;
}
}
}
}
- return CompletelyUnroll ? LoopUnrollStatus::FullyUnrolled
- : LoopUnrollStatus::PartiallyUnrolled;
+ return CompletelyUnroll ? LoopUnrollResult::FullyUnrolled
+ : LoopUnrollResult::PartiallyUnrolled;
}
/// Given an llvm.loop loop id metadata node, returns the loop hint metadata