llvm::GetIfCondition

Return the branch that selects between predecessors of an if-merge block.

Synopsis

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

CondBrInst*
GetIfCondition(
    BasicBlock* BB,
    BasicBlock*& IfTrue,
    BasicBlock*& IfFalse);

Description

Check whether BB is the merge point of a if-region. If so, return the branch instruction that determines which entry into BB will be taken. Also, return by references the block that will be entered from if the condition is true, and the block that will be entered if the condition is false.

This does no checking to see if the true/false blocks have large or unsavory instructions in them.

Return Value

The conditional branch that selects between predecessors of BB, or null if BB is not an if-merge.

Parameters

NameDescription
BBCandidate merge block of an if-region.
IfTrueSet to the predecessor entered when the condition is true.
IfFalseSet to the predecessor entered when the condition is false.