llvm::UnrollAndJamLoop

Unroll the outer loop and jam its iterations with the inner loop.

Synopsis

Declared in <llvm/Transforms/Utils/UnrollLoop.h>

LoopUnrollResult
UnrollAndJamLoop(
    Loop* L,
    unsigned int Count,
    unsigned int TripCount,
    unsigned int TripMultiple,
    bool UnrollRemainder,
    LoopInfo* LI,
    ScalarEvolution* SE,
    DominatorTree* DT,
    AssumptionCache* AC,
    TargetTransformInfo const* TTI,
    OptimizationRemarkEmitter* ORE,
    Loop** EpilogueLoop = nullptr);

Description

isSafeToUnrollAndJam should be used prior to calling this to make sure the unrolling will be valid. Checking profitability is also advisable.

Return Value

Whether the loop was unmodified, partially unrolled, or fully unrolled.

Parameters

NameDescription
LOuter loop to unroll-and-jam (must contain exactly one inner loop).
CountUnroll factor for the outer loop.
TripCountKnown trip count of the outer loop, or 0 if unknown.
TripMultipleGreatest known multiple of the outer-loop trip count.
UnrollRemainderUnroll any epilogue created for a non-multiple count.
LILoopInfo to keep consistent.
SEScalarEvolution analysis to update.
DTDominator tree to update.
ACAssumption cache used by simplifications.
TTITarget transform info for cost-aware decisions.
ORERemark emitter for optimization diagnostics.
EpilogueLoopIf non-null, receives the epilogue loop when one is created and not fully unrolled.