Create a new intermediate target block for a callbr or switch edge.

Synopsis

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

BasicBlock*
SplitMultiBrEdge(
    BasicBlock* MultiBrBlock,
    BasicBlock* Succ,
    unsigned int SuccIdx,
    BasicBlock* BrTarget = nullptr,
    DomTreeUpdater* DTU = nullptr,
    CycleInfo* CI = nullptr,
    LoopInfo* LI = nullptr,
    bool* UpdatedLI = nullptr);

Description

Create a new basic block between a callbr or switch instruction and one of its successors. The new block replaces the original successor in the callbr/switch instruction and unconditionally branches to the original successor. This is useful for normalizing control flow, e.g., when transforming irreducible loops.

Note

This function updates PHI nodes, dominator tree, loop info, and cycle info as needed.

Return Value

newly created intermediate target block

Parameters

Name

Description

MultiBrBlock

block containing the callbr or switch instruction

Succ

original successor block

SuccIdx

index of the original successor in the terminator instruction

BrTarget

optional BasicBlock generated by SplitMultiBrEdge to reuse for the split

DTU

optional DomTreeUpdater for updating the dominator tree

CI

optional CycleInfo for updating cycle membership

LI

optional LoopInfo for updating loop membership

UpdatedLI

optional output flag indicating if LoopInfo has been updated

Created with MrDocs