|
LLVM 23.0.0git
|
Conditional Branch instruction. More...
#include "llvm/IR/Instructions.h"
Public Member Functions | |
| DECLARE_TRANSPARENT_OPERAND_ACCESSORS (Value) | |
| Transparently provide more efficient getOperand methods. | |
| Value * | getCondition () const |
| void | setCondition (Value *V) |
| unsigned | getNumSuccessors () const |
| BasicBlock * | getSuccessor (unsigned i) const |
| void | setSuccessor (unsigned idx, BasicBlock *NewSucc) |
| LLVM_ABI void | swapSuccessors () |
| Swap the successors of this branch instruction. | |
| iterator_range< succ_iterator > | successors () |
| iterator_range< const_succ_iterator > | successors () const |
Static Public Member Functions | |
| static CondBrInst * | Create (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 CondBrInst * | cloneImpl () const |
Friends | |
| class | Instruction |
| Iterator for Instructions in a `BasicBlock. | |
Conditional Branch instruction.
Definition at line 3213 of file Instructions.h.
|
inlinestatic |
Definition at line 3276 of file Instructions.h.
References I, and Instruction.
Referenced by classof().
Definition at line 3279 of file Instructions.h.
References llvm::cast(), classof(), and llvm::isa().
|
protected |
Definition at line 4513 of file Instructions.cpp.
Referenced by Instruction.
|
inlinestatic |
Definition at line 3234 of file Instructions.h.
References Cond.
Referenced by llvm::IRBuilderBase::CreateCondBr(), llvm::IRBuilderBase::CreateCondBr(), createMemMoveLoopUnknownSize(), llvm::emitAMDGPUPrintfCall(), llvm::EpilogueVectorizerMainLoop::emitIterationCountCheck(), handleNBranch(), insertBoundsCheck(), llvm::InsertCFGStrategy::mutate(), runImpl(), setupBranchForGuard(), simplifySwitchOfPowersOfTwo(), llvm::SplitBlockAndInsertIfThenElse(), llvm::fuzzerop::splitBlockDescriptor(), and llvm::JumpThreadingPass::unfoldSelectInstr().
| llvm::CondBrInst::DECLARE_TRANSPARENT_OPERAND_ACCESSORS | ( | Value | ) |
Transparently provide more efficient getOperand methods.
|
inline |
Definition at line 3243 of file Instructions.h.
Referenced by BrPHIToSelect(), buildPartialInvariantUnswitchConditionalBranch(), canFoldTermCondOfLoop(), canSplitLoopBound(), createFoldedExitCond(), createInvariantCond(), DoFlattenLoopPair(), findBestNonTrivialUnswitchCandidate(), FlattenLoopPair(), llvm::foldBranchToCommonDest(), foldCondBranchOnValueKnownInPredecessorImpl(), foldTwoEntryPHINode(), getBranchCondString(), getBranchWeights(), llvm::Loop::LoopBounds::getCanonicalPredicate(), getInnerLoopGuardCmp(), getKnownValueOnEdge(), getOuterLoopLatchCmp(), hoistConditionalLoadsStores(), llvm::InvertBranch(), llvm::ScalarEvolution::isBasicBlockEntryGuardedByCond(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), isLoopExitTestBasedOn(), matchCondition(), matchShiftULTCondition(), mergeConditionalStoreToAddress(), mergeNestedCondBranch(), needsLFTR(), optimizeLoopExitWithUnknownExitCount(), performBranchToCommonDestFolding(), llvm::DomConditionCache::registerBranch(), removeUndefIntroducingPredecessor(), replaceExitCond(), reuseTableCompare(), RunTermFold(), llvm::setWidenableBranchCond(), SimplifyCondBranchToCondBranch(), simplifyInstructionWithPHI(), simplifyOneLoop(), llvm::JumpThreadingPass::threadGuard(), unswitchNontrivialInvariants(), unswitchTrivialBranch(), llvm::InstCombinerImpl::visitCondBrInst(), and llvm::widenWidenableBranch().
|
inline |
Definition at line 3246 of file Instructions.h.
Referenced by getSuccessor(), and setSuccessor().
|
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::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().
|
inline |
Definition at line 3244 of file Instructions.h.
Referenced by FlattenLoopPair(), llvm::InvertBranch(), mergeNestedCondBranch(), performBranchToCommonDestFolding(), replaceExitCond(), RunTermFold(), llvm::setWidenableBranchCond(), SimplifyCondBranchToCondBranch(), splitLoopBound(), llvm::UnrollRuntimeLoopRemainder(), unswitchNontrivialInvariants(), unswitchTrivialBranch(), and llvm::widenWidenableBranch().
|
inline |
Definition at line 3253 of file Instructions.h.
References assert(), and getNumSuccessors().
Referenced by insertLoopExpansion(), llvm::MergeBlockIntoPredecessor(), mergeNestedCondBranch(), performBranchToCommonDestFolding(), SimplifyCondBranchToCondBranch(), splitLoopBound(), tryWidenCondBranchToCondBranch(), llvm::UnrollAndJamLoop(), unswitchNontrivialInvariants(), and unswitchTrivialBranch().
|
inline |
Definition at line 3265 of file Instructions.h.
References llvm::make_range().
|
inline |
Definition at line 3270 of file Instructions.h.
References llvm::make_range().
| 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().
|
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.