Split a block and insert optional then/else blocks at an instruction.
Synopsis
Declared in <llvm/Transforms/Utils/BasicBlockUtils.h>
void
SplitBlockAndInsertIfThenElse(
Value* Cond,
Instruction* SplitBefore,
BasicBlock** ThenBlock,
BasicBlock** ElseBlock,
bool UnreachableThen = false,
bool UnreachableElse = false,
MDNode* BranchWeights = nullptr,
DomTreeUpdater* DTU = nullptr,
LoopInfo* LI = nullptr);
Parameters
Name |
Description |
Cond |
Condition controlling the inserted branch. |
SplitBefore |
Instruction at which the block is split. |
ThenBlock |
In/out then‐block pointer controlling then‐path creation. |
ElseBlock |
In/out else‐block pointer controlling else‐path creation. |
UnreachableThen |
Whether a newly created then‐block ends with unreachable. |
UnreachableElse |
Whether a newly created 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. |
Created with MrDocs