LLVM 23.0.0git
llvm::CondBrInst Class Reference

Conditional Branch instruction. More...

#include "llvm/IR/Instructions.h"

Inheritance diagram for llvm::CondBrInst:
[legend]

Public Member Functions

 DECLARE_TRANSPARENT_OPERAND_ACCESSORS (Value)
 Transparently provide more efficient getOperand methods.
ValuegetCondition () const
void setCondition (Value *V)
unsigned getNumSuccessors () const
BasicBlockgetSuccessor (unsigned i) const
void setSuccessor (unsigned idx, BasicBlock *NewSucc)
LLVM_ABI void swapSuccessors ()
 Swap the successors of this branch instruction.
iterator_range< succ_iteratorsuccessors ()
iterator_range< const_succ_iteratorsuccessors () const

Static Public Member Functions

static CondBrInstCreate (Value *Cond, BasicBlock *IfTrue, BasicBlock *IfFalse, InsertPosition InsertBefore=nullptr)
static bool classof (const Instruction *I)
static bool classof (const Value *V)

Protected Member Functions

LLVM_ABI CondBrInstcloneImpl () const

Friends

class Instruction
 Iterator for Instructions in a `BasicBlock.

Detailed Description

Conditional Branch instruction.

Definition at line 3213 of file Instructions.h.

Member Function Documentation

◆ classof() [1/2]

bool llvm::CondBrInst::classof ( const Instruction * I)
inlinestatic

Definition at line 3276 of file Instructions.h.

References I, and Instruction.

Referenced by classof().

◆ classof() [2/2]

bool llvm::CondBrInst::classof ( const Value * V)
inlinestatic

Definition at line 3279 of file Instructions.h.

References llvm::cast(), classof(), and llvm::isa().

◆ cloneImpl()

CondBrInst * CondBrInst::cloneImpl ( ) const
protected

Definition at line 4513 of file Instructions.cpp.

Referenced by Instruction.

◆ Create()

◆ DECLARE_TRANSPARENT_OPERAND_ACCESSORS()

llvm::CondBrInst::DECLARE_TRANSPARENT_OPERAND_ACCESSORS ( Value )

Transparently provide more efficient getOperand methods.

◆ getCondition()

◆ getNumSuccessors()

unsigned llvm::CondBrInst::getNumSuccessors ( ) const
inline

Definition at line 3246 of file Instructions.h.

Referenced by getSuccessor(), and setSuccessor().

◆ getSuccessor()

BasicBlock * llvm::CondBrInst::getSuccessor ( unsigned i) const
inline

Definition at line 3248 of file Instructions.h.

References assert(), llvm::cast_or_null(), llvm::get(), and getNumSuccessors().

Referenced by BrPHIToSelect(), llvm::PredicateInfoBuilder::buildPredicateInfo(), checkBiasedBranch(), llvm::JumpThreadingPass::duplicateCondBranchOnPHIIntoPred(), estimateLoopTripCount(), FindWidenableTerminatorAboveLoop(), foldCondBranchOnValueKnownInPredecessorImpl(), foldTwoEntryPHINode(), llvm::Loop::LoopBounds::getCanonicalPredicate(), getExpectedExitLoopLatchBranch(), llvm::GetIfCondition(), llvm::LoopVectorizationCostModel::getInstructionCost(), getKnownValueOnEdge(), llvm::getLoopEstimatedTripCount(), llvm::Loop::getLoopGuardBranch(), llvm::getLoopProbability(), handlePhiDef(), llvm::Instruction::hasNoUnsignedWrap(), llvm::ScalarEvolution::isBasicBlockEntryGuardedByCond(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), isProfitableToTransform(), matchCondition(), matchShiftULTCondition(), llvm::JumpThreadingPass::maybethreadThroughTwoBasicBlocks(), llvm::MergeBlockIntoPredecessor(), mergeConditionalStores(), mergeNestedCondBranch(), optimizeLoopExitWithUnknownExitCount(), performBranchToCommonDestFolding(), profitableToRotateLoopExitingLatch(), removeUndefIntroducingPredecessor(), replaceConditionalBranchesOnConstant(), RunTermFold(), llvm::setLoopEstimatedTripCount(), llvm::setLoopProbability(), shouldFoldCondBranchesToCommonDestination(), shouldTryInjectBasingOnMetadata(), SimplifyCondBranchToCondBranch(), simplifyInstructionWithPHI(), simplifyOneLoop(), splitLoopBound(), llvm::JumpThreadingPass::threadGuard(), llvm::JumpThreadingPass::threadThroughTwoBasicBlocks(), tryWidenCondBranchToCondBranch(), turnGuardIntoBranch(), llvm::UnrollAndJamLoop(), llvm::UnrollRuntimeLoopRemainder(), unswitchNontrivialInvariants(), unswitchTrivialBranch(), updatePredecessorProfileMetadata(), violatesLegacyMultiExitLoopCheck(), and llvm::InstCombinerImpl::visitCondBrInst().

◆ setCondition()

◆ setSuccessor()

◆ successors() [1/2]

iterator_range< succ_iterator > llvm::CondBrInst::successors ( )
inline

Definition at line 3265 of file Instructions.h.

References llvm::make_range().

◆ successors() [2/2]

iterator_range< const_succ_iterator > llvm::CondBrInst::successors ( ) const
inline

Definition at line 3270 of file Instructions.h.

References llvm::make_range().

◆ swapSuccessors()

void CondBrInst::swapSuccessors ( )

Swap the successors of this branch instruction.

Swaps the successors of the branch instruction. This also swaps any branch weight metadata associated with the instruction so that it continues to map correctly to each operand.

Definition at line 1240 of file Instructions.cpp.

Referenced by llvm::InstCombinerImpl::freelyInvertAllUsersOf(), llvm::InvertBranch(), RunTermFold(), turnGuardIntoBranch(), and llvm::InstCombinerImpl::visitCondBrInst().

◆ Instruction

friend class Instruction
friend

Iterator for Instructions in a `BasicBlock.

/ \Returns an sandboxir::Instruction & when derereferenced. class BBIterator { public: using difference_type = std::ptrdiff_t; using value_type = Instruction; using pointer = value_type *; using reference = value_type &; using iterator_category = std::bidirectional_iterator_tag;

private: llvm::BasicBlock *BB; llvm::BasicBlock::iterator It; Context *Ctx; LLVM_ABI pointer getInstr(llvm::BasicBlock::iterator It) const;

public: BBIterator() : BB(nullptr), Ctx(nullptr) {} BBIterator(llvm::BasicBlock <em>BB, llvm::BasicBlock::iterator It, Context *Ctx) : BB(BB), It(It), Ctx(Ctx) {} reference operator() const { return *getInstr(It); } LLVM_ABI BBIterator &operator++(); BBIterator operator++(int) { auto Copy = *this; ++*this; return Copy; } LLVM_ABI BBIterator &operator--(); BBIterator operator--(int) { auto Copy = *this; –*this; return Copy; } bool operator==(const BBIterator &Other) const { assert(Ctx == Other.Ctx && "BBIterators in different context!"); return It == Other.It; } bool operator!=(const BBIterator &Other) const { return !(*this == Other); } / \Returns the SBInstruction that corresponds to this iterator, or null if / the instruction is not found in the IR-to-SandboxIR tables. pointer get() const { return getInstr(It); } / \Returns the parent BB. LLVM_ABI BasicBlock *getNodeParent() const; };

/ Contains a list of sandboxir::Instruction's. class BasicBlock : public Value { / Builds a graph that contains all values in BB in their original form / i.e., no vectorization is taking place here. LLVM_ABI void buildBasicBlockFromLLVMIR(llvm::BasicBlock *LLVMBB); friend class Context; // For buildBasicBlockFromIR

Definition at line 3224 of file Instructions.h.

References cloneImpl(), Instruction, and LLVM_ABI.

Referenced by classof(), and Instruction.


The documentation for this class was generated from the following files: