Split a block and insert a conditional else‐branch around the split point.

Synopsis

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

Instruction*
SplitBlockAndInsertIfElse(
    Value* Cond,
    BasicBlock::iterator SplitBefore,
    bool Unreachable,
    MDNode* BranchWeights = nullptr,
    DomTreeUpdater* DTU = nullptr,
    LoopInfo* LI = nullptr,
    BasicBlock* ElseBlock = nullptr);

Description

Similar to SplitBlockAndInsertIfThen, but the inserted block is on the false path of the branch.

Return Value

The terminator of the else‐block.

Parameters

Name

Description

Cond

Condition controlling the inserted branch.

SplitBefore

Instruction at which the block is split.

Unreachable

Whether the else‐block ends with unreachable.

BranchWeights

Optional branch‐weight metadata for the new branch.

DTU

Optional dominator‐tree updater for CFG changes.

LI

Optional loop info to update.

ElseBlock

Optional existing block to use as the else‐block.

Created with MrDocs