Clones a loop OrigLoop.

Synopsis

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

Loop*
cloneLoopWithPreheader(
    BasicBlock* Before,
    BasicBlock* LoopDomBB,
    Loop* OrigLoop,
    ValueToValueMapTy& VMap,
    Twine const& NameSuffix,
    LoopInfo* LI,
    DominatorTree* DT,
    SmallVectorImpl<BasicBlock*>& Blocks);

Description

Updates LoopInfo and DominatorTree assuming the loop is dominated by block LoopDomBB. Insert the new blocks before block specified in Before. The client needs to further update the CFG and DominatorTree after calling this function, to ensure the IR remains valid. Note: Only innermost loops are supported. The cloned blocks are also recorded in Blocks.

Return Value

The cloned loop.

Parameters

Name

Description

Before

Block before which newly cloned blocks are inserted.

LoopDomBB

Block assumed to dominate the original loop.

OrigLoop

Loop to clone.

VMap

Mapping updated with correspondences for cloned values.

NameSuffix

Suffix appended to cloned value and block names.

LI

LoopInfo to update with the cloned loop.

DT

DominatorTree to update for the cloned blocks.

Blocks

Filled with the basic blocks belonging to the cloned loop.

Created with MrDocs