[#llvm-ConstantFoldTerminator] = xref:llvm.adoc[llvm]::ConstantFoldTerminator :relfileprefix: ../ :mrdocs: Fold a constant‐predicated terminator into an unconditional branch. == Synopsis Declared in `<llvm/Transforms/Utils/Local.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool ConstantFoldTerminator( xref:llvm/BasicBlock.adoc[BasicBlock]* BB, bool DeleteDeadConditions = false, xref:llvm/TargetLibraryInfo.adoc[TargetLibraryInfo] const* TLI = nullptr, xref:llvm/DomTreeUpdater.adoc[DomTreeUpdater]* DTU = nullptr); ---- == Description If a terminator instruction is predicated on a constant value, convert it into an unconditional branch to the constant destination. This is a nontrivial operation because the successors of this basic block must have their PHI nodes updated. Also calls RecursivelyDeleteTriviallyDeadInstructions() on any branch/switch conditions and indirectbr addresses this might make dead if DeleteDeadConditions is true. == Return Value True if the terminator was folded into an unconditional branch. == Parameters [cols="1,4"] |=== | Name| Description | *BB* | Basic block whose terminator may be folded. | *DeleteDeadConditions* | Whether to delete conditions made dead by the fold. | *TLI* | Optional target library info for dead‐instruction analysis. | *DTU* | Optional dominator‐tree updater for CFG changes. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#