Rewrite computable loop exit values into users outside the loop.

Synopsis

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

int
rewriteLoopExitValues(
    Loop* L,
    LoopInfo* LI,
    TargetLibraryInfo* TLI,
    ScalarEvolution* SE,
    TargetTransformInfo const* TTI,
    SCEVExpander& Rewriter,
    DominatorTree* DT,
    ReplaceExitVal ReplaceExitValue,
    SmallVector<WeakTrackingVH, 16>& DeadInsts);

Description

If the final value of any expressions that are recurrent in the loop can be computed, substitute the exit values from the loop into any instructions outside of the loop that use the final values of the current expressions. Return the number of loop exit values that have been replaced, and the corresponding phi node will be added to DeadInsts.

Return Value

The number of loop exit values that were replaced.

Parameters

Name

Description

L

Loop whose exit values may be rewritten.

LI

Loop info for the function.

TLI

Target library info.

SE

ScalarEvolution used to compute exit values.

TTI

Target transform info for expansion cost.

Rewriter

SCEV expander used to materialize exit values.

DT

Dominator tree for the function.

ReplaceExitValue

Policy controlling which exits are rewritten.

DeadInsts

Collects PHI nodes made dead by the rewrite.

Created with MrDocs