llvm::SplitBlockAndInsertIfElse

SplitBlockAndInsertIfElse overloads

Synopses

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

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

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

Split a block and insert an else-branch at an instruction.

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

Return Value

The terminator of the else-block.

Parameters

NameDescription
CondCondition controlling the inserted branch.
SplitBeforeInstruction at which the block is split.
UnreachableWhether the else-block ends with unreachable.
BranchWeightsOptional branch-weight metadata for the new branch.
DTUOptional dominator-tree updater for CFG changes.
LIOptional loop info to update.
ElseBlockOptional existing block to use as the else-block.