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

Name

Description

L

Outer loop to unroll‐and‐jam (must contain exactly one inner loop).

Count

Unroll factor for the outer loop.

TripCount

Known trip count of the outer loop, or 0 if unknown.

TripMultiple

Greatest known multiple of the outer‐loop trip count.

UnrollRemainder

Unroll any epilogue created for a non‐multiple count.

LI

LoopInfo to keep consistent.

SE

ScalarEvolution analysis to update.

DT

Dominator tree to update.

AC

Assumption cache used by simplifications.

TTI

Target transform info for cost‐aware decisions.

ORE

Remark emitter for optimization diagnostics.

EpilogueLoop

If non‐null, receives the epilogue loop when one is created and not fully unrolled.

Created with MrDocs