llvm::SplitBlockAndInsertSimpleForLoop

Insert a simple counted for-loop at a split point.

Synopsis

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

std::pair<Instruction*, Value*>
SplitBlockAndInsertSimpleForLoop(
    Value* End,
    BasicBlock::iterator SplitBefore);

Description

Insert a for (int i = 0; i < End; i++) loop structure (with the exception that End is assumed > 0, and thus not checked on entry) at SplitBefore. Returns the first insert point in the loop body, and the PHINode for the induction variable (i.e. "i" above).

Return Value

A pair of the first insert point in the loop body and the induction variable.

Parameters

NameDescription
EndExclusive upper bound of the induction variable; assumed > 0.
SplitBeforeInstruction at which the loop is inserted.