Insert a runtime prolog or epilog so L can be unrolled by Count.
Declared in <llvm/Transforms/Utils/UnrollLoop.h>
bool
UnrollRuntimeLoopRemainder(
Loop* L,
unsigned int Count,
bool AllowExpensiveTripCount,
bool UseEpilogRemainder,
bool UnrollRemainder,
bool ForgetAllSCEV,
LoopInfo* LI,
ScalarEvolution* SE,
DominatorTree* DT,
AssumptionCache* AC,
TargetTransformInfo const* TTI,
bool PreserveLCSSA,
unsigned int SCEVExpansionBudget,
bool RuntimeUnrollMultiExit,
Loop** ResultLoop = nullptr,
std::optional<unsigned int> OriginalTripCount = std::nullopt,
BranchProbability OriginalLoopProb = BranchProbability::getUnknown());
Ensures the latch trip count is a multiple of Count when the trip count is not known statically. May create and optionally unroll a remainder loop.
True if the remainder transformation succeeded.
| Name | Description |
|---|---|
| L | Loop to prepare for runtime unrolling. |
| Count | Unroll factor that the remainder logic must satisfy. |
| AllowExpensiveTripCount | Allow costly run-time trip-count computation. |
| UseEpilogRemainder | Prefer an epilog remainder over a prolog. |
| UnrollRemainder | Unroll the generated remainder loop when profitable. |
| ForgetAllSCEV | Forget all SCEV expressions for the loop after rewrite. |
| LI | LoopInfo to keep consistent. |
| SE | ScalarEvolution used to compute the trip count. |
| DT | Dominator tree to update. |
| AC | Assumption cache used by subsequent simplifications. |
| TTI | Target transform info for cost checks. |
| PreserveLCSSA | Whether to preserve LCSSA form. |
| SCEVExpansionBudget | Budget for expanding the trip-count SCEV. |
| RuntimeUnrollMultiExit | Allow runtime unrolling with multiple exits. |
| ResultLoop | If non-null, receives the remainder loop when created. |
| OriginalTripCount | Optional original trip count used for probabilities. |
| OriginalLoopProb | Optional original loop-latch branch probability. |