LLVM Basic Block Representation. More...
#include "llvm/IR/BasicBlock.h"
SkipPseudoOp is true. SkipPseudoOp is true. MovePos lives in, right before MovePos. MovePos in the function MovePos lives in. FromBB to this basic block at ToIt. FromBB at FromIt to this basic block at ToIt. FromBB from FromBeginIt to FromEndIt, to this basic block at ToIt. FromIt to (not including) ToIt. New instead of basic block Old. New instead of basic block Old. New instead of to it. User that can safely be removed. Other plus a constant offset, return that offset in bytes. nullptr for the list tail. U. MDs, sorting by KindID. LLVM Basic Block Representation.
This represents a single basic block in LLVM. A basic block is simply a container of instructions that execute sequentially. Basic blocks are Values because they are referenced by instructions such as branches and switch tables. The type of a BasicBlock is "Type::LabelTy" because the basic block represents a label to which a branch can jump.
A well formed basic block is formed of a list of non-terminating instructions followed by a single terminator instruction. Terminator instructions may not occur in the middle of basic blocks, and must terminate the blocks. The BasicBlock class allows malformed basic blocks to occur because it may be useful in the intermediate stage of constructing or modifying a program. However, the verifier will ensure that basic blocks are "well formed".
Definition at line 61 of file BasicBlock.h.
Definition at line 171 of file BasicBlock.h.
Definition at line 522 of file BasicBlock.h.
Definition at line 173 of file BasicBlock.h.
Definition at line 64 of file BasicBlock.h.
Instruction iterators...
Definition at line 170 of file BasicBlock.h.
Definition at line 521 of file BasicBlock.h.
Definition at line 172 of file BasicBlock.h.
Definition at line 168 of file BasicBlock.cpp.
Definition at line 485 of file BasicBlock.h.
Definition at line 484 of file BasicBlock.h.
Referenced by llvm::Function::back(), llvm::Function::back(), llvm::AAResults::canBasicBlockModify(), llvm::changeToInvokeAndSplitBasicBlock(), emptyAndDetachBlock(), llvm::FastISel::fastEmitBranch(), llvm::MergeBlockIntoPredecessor(), phiNodeRemapHelper(), restoreIPandDebugLoc(), llvm::SimplifyInstructionsInBlock(), and llvm::TryToSimplifyUncondBranchFromEmptyBlock().
Instruction iterator methods.
Definition at line 459 of file BasicBlock.h.
Referenced by llvm::calculateWasmEHInfo(), llvm::Interpreter::callFunction(), canLoopBeDeleted(), CanPropagatePredecessorsForPHIs(), canSplitCallSite(), llvm::CloneAndPruneIntoFromInst(), cloneInstructionInExitBlock(), llvm::FunctionComparator::cmpBasicBlocks(), llvm::IRSimilarity::IRInstructionMapper::convertToUnsignedVec(), llvm::SSAUpdaterTraits< SSAUpdater >::CreateEmptyPHI(), createOutlinedFunction(), llvm::createPHIsForSplitLoopExit(), createRetBitCast(), createRetPHINode(), llvm::VPlan::createVPIRBasicBlock(), despeculateCountZeros(), llvm::PostDominatorTree::dominates(), llvm::JumpThreadingPass::duplicateCondBranchOnPHIIntoPred(), llvm::DuplicateInstructionsInSplitBetween(), EliminateDuplicatePHINodesNaiveImpl(), EliminateDuplicatePHINodesSetBasedImpl(), ensureValueAvailableInSuccessor(), llvm::Evaluator::EvaluateFunction(), expandFPToI(), expandIToFP(), llvm::CodeExtractor::extractCodeRegion(), llvm::findAvailablePtrLoadStore(), findDependencies(), findDuplicateOutputBlock(), llvm::CodeExtractor::findOrCreateBlockForHoisting(), findOrCreatePHIInBlock(), llvm::SSAUpdaterTraits< SSAUpdater >::FindPredecessorBlocks(), foldCondBranchOnValueKnownInPredecessorImpl(), foldMemChr(), llvm::FoldSingleEntryPHINodes(), foldTwoEntryPHINode(), formLCSSAForInstructionsImpl(), generateUnsignedDivisionCode(), llvm::ScalarEvolution::getAddExpr(), llvm::MemoryDependenceResults::getDependency(), llvm::GetIfCondition(), llvm::sandboxir::getInsertPointAfterInstrs(), llvm::MemoryDependenceResults::getNonLocalCallDependency(), llvm::MemoryDependenceResults::getSimplePointerDependencyFrom(), getStrlenWithNull(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), HandleByValArgumentInit(), HandleInlinedEHPad(), llvm::hoistAllInstructionsInto(), llvm::InlineFunctionImpl(), InsertSafepointPoll(), insertSinCosCall(), insertSpills(), insertTrivialPHIs(), llvm::instrs(), isBlockValidForExtraction(), llvm::CodeExtractor::isEligible(), makeStatepointExplicitImpl(), markPointerAsAS(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), llvm::InstCombinerImpl::mergeStoreIntoSuccessor(), moveBBContents(), movePHIValuesToInsertedBlock(), llvm::InsertPHIStrategy::mutate(), optimizeBlock(), optimizeSQRT(), ProcessBlock(), programUndefinedIfUndefOrPoison(), promoteMemoryToRegister(), reconnectPhis(), rewritePHINodesForExitAndUnswitchedBlocks(), RewriteUsesOfClonedInstructions(), runPass(), scalarizeMaskedCompressStore(), scalarizeMaskedExpandLoad(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), scalarizeMaskedVectorHistogram(), scanInlinedCode(), SimplifyCondBranchToCondBranch(), llvm::SimplifyInstructionsInBlock(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), splice(), SplitBlockPredecessorsImpl(), splitCallSite(), llvm::SplitIndirectBrCriticalEdges(), llvm::SplitKnownCriticalEdge(), splitLoopBound(), llvm::JumpThreadingPass::threadEdge(), llvm::JumpThreadingPass::threadGuard(), llvm::JumpThreadingPass::threadThroughTwoBasicBlocks(), tryToMergeLandingPad(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), llvm::JumpThreadingPass::tryToUnfoldSelectInCurrBB(), llvm::JumpThreadingPass::unfoldSelectInstr(), llvm::UnrollLoop(), unswitchTrivialSwitch(), UpdatePHINodes(), llvm::InstVisitor< UnrolledInstAnalyzer, bool >::visit(), and llvm::Interpreter::visitIntrinsicInst().
Definition at line 467 of file BasicBlock.h.
Definition at line 523 of file BasicBlock.cpp.
Referenced by canSplitCallSite(), canSplitPredecessors(), and SplitBlockPredecessorsImpl().
Methods for support type inquiry through isa, cast, and dyn_cast.
Definition at line 588 of file BasicBlock.h.
References llvm::Value::Value().
Convert variable location debugging information stored in DbgMarkers and DbgRecords into the dbg.value intrinsic representation.
Sets IsNewDbgInfoFormat = false.
Definition at line 89 of file BasicBlock.cpp.
Convert variable location debugging information stored in dbg.value intrinsics into DbgMarkers / DbgRecords.
Deletes all dbg.values in the process and sets IsNewDbgInfoFormat = true.
Definition at line 53 of file BasicBlock.cpp.
References llvm::cast(), llvm::cast_or_null(), F, and Function.
Creates a new BasicBlock.
If the Parent parameter is specified, the basic block is automatically inserted at either the end of the function (if InsertBefore is 0), or before the specified basic block.
Definition at line 206 of file BasicBlock.h.
References Create().
Referenced by addBoundsChecking(), assureFPCallStub(), llvm::CloneBasicBlock(), convertToGuardPredicates(), Create(), createAndInsertBasicBlocks(), llvm::MIRParserImpl::createDummyFunction(), createDummyReturnBlock(), CreateFailBB(), createFPFnStub(), createFrameHelperMachineFunction(), llvm::RandomIRBuilder::createFunctionDefinition(), llvm::createMemCpyLoopKnownSize(), createMemMoveLoopUnknownSize(), createMemSetLoop(), createOutlinedFunction(), llvm::createSanitizerCtor(), llvm::createSanitizerCtorAndInitFunctions(), llvm::Attributor::createShallowWrapper(), createThunk(), llvm::ThunkInserter< Derived, InsertedThunksTy >::createThunkFunction(), createUnreachableSwitchDefault(), createWrapper(), llvm::ehAwareSplitEdge(), llvm::orc::IRSpeculationLayer::emit(), llvm::emitAMDGPUPrintfCall(), llvm::SITargetLowering::emitExpandAtomicAddrSpacePredicate(), emitTargetTaskProxyFunction(), expandFPToI(), expandIToFP(), expandToSwitch(), findOrCreatePHIBlock(), llvm::SanitizerStatReport::finish(), foldMemChr(), generateReproducer(), generateUnsignedDivisionCode(), getStrlenWithNull(), injectPendingInvariantConditions(), insertUniqueBackedgeBlock(), LLVMAppendBasicBlockInContext(), LLVMCreateBasicBlockInContext(), LLVMInsertBasicBlockInContext(), lowerFunnelShifts(), llvm::lowerGlobalIFuncUsersAsGlobalCtor(), lowerIntrinsicToFunction(), llvm::lowerUnaryVectorIntrinsicAsLoop(), makeFunctionBodyUnreachable(), llvm::orc::makeStub(), markAliveBlocks(), mergeComparisons(), mergeCompatibleInvokesImpl(), llvm::InsertCFGStrategy::mutate(), llvm::EscapeEnumerator::Next(), performBlockTailMerging(), populateReductionFunction(), processSwitch(), llvm::SCCPSolver::removeNonFeasibleEdges(), removeUndefIntroducingPredecessor(), rewritePHIsForCleanupPad(), runImpl(), runImpl(), SimplifyCondBranchToCondBranch(), simplifySwitchLookup(), llvm::SplitBlockAndInsertIfThenElse(), SplitBlockPredecessorsImpl(), llvm::SplitCallBrEdge(), llvm::coro::AnyRetconABI::splitCoroutine(), llvm::coro::AsyncABI::splitCoroutine(), llvm::SplitKnownCriticalEdge(), SplitLandingPadPredecessorsImpl(), llvm::JumpThreadingPass::threadEdge(), llvm::JumpThreadingPass::threadThroughTwoBasicBlocks(), and llvm::JumpThreadingPass::unfoldSelectInstr().
Definition at line 42 of file BasicBlock.cpp.
References llvm::cast().
Attach a DbgMarker to the given instruction.
Enables the storage of any debug-info at this position in the program.
Definition at line 33 of file BasicBlock.cpp.
Referenced by llvm::JumpThreadingPass::cloneInstructions().
Delete any trailing DbgRecords at the end of this block, see setTrailingDbgRecords.
Definition at line 1132 of file BasicBlock.cpp.
Cause all subinstructions to "let go" of all the references that said subinstructions are maintaining.
This allows one to 'delete' a whole class at a time, even though there may be circular references... first all references are dropped, and all use counts go to zero. Then everything is delete'd for real. Note that no operations are valid on an object that has "dropped all references", except operator delete.
Definition at line 432 of file BasicBlock.cpp.
Definition at line 114 of file BasicBlock.cpp.
References llvm::any_of(), llvm::cast(), llvm::Value::getName(), and I.
Definition at line 481 of file BasicBlock.h.
Referenced by emptyAndDetachBlock(), llvm::CodeExtractor::extractCodeRegion(), getEndIterator(), llvm::sandboxir::getInsertPointAfterInstrs(), restoreIPandDebugLoc(), and rewritePHIs().
Definition at line 472 of file BasicBlock.h.
Referenced by buildPartialInvariantUnswitchConditionalBranch(), llvm::changeToUnreachable(), llvm::MemorySSAUpdater::changeToUnreachable(), llvm::CloneBasicBlock(), llvm::JumpThreadingPass::cloneInstructions(), llvm::FunctionComparator::cmpBasicBlocks(), llvm::ConvertDebugDeclareToDebugValue(), llvm::IRSimilarity::IRInstructionMapper::convertToUnsignedVec(), llvm::convertUsersOfConstantsToInstructions(), createSwitchStatement(), createTargetLoopWorkshareCall(), createWrapper(), detectPopcountIdiom(), detectShiftUntilLessThanIdiom(), detectShiftUntilZeroIdiom(), llvm::JumpThreadingPass::duplicateCondBranchOnPHIIntoPred(), llvm::SITargetLowering::emitExpandAtomicAddrSpacePredicate(), llvm::CodeExtractor::findOrCreateBlockForHoisting(), llvm::InstCombinerImpl::foldIntegerTypedPHI(), getConvergenceEntry(), getEndIterator(), getInsertPt(), getInsertPt(), getInstrBB(), llvm::MemoryDependenceResults::getNonLocalCallDependency(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), llvm::objcarc::BottomUpPtrState::HandlePotentialUse(), llvm::hoistAllInstructionsInto(), llvm::insertDebugValuesForPHIs(), llvm::DIBuilder::insertDeclare(), llvm::sandboxir::Instruction::insertInto(), llvm::sandboxir::InsertPosition::InsertPosition(), InsertSafepointPoll(), llvm::instrs(), llvm::SampleProfileProber::instrumentOneFunc(), isBlockValidForExtraction(), llvm::isInTailCallPosition(), llvm::MergeBlockIntoPredecessor(), mergeCompatibleInvokesImpl(), moveBBContents(), llvm::RandomIRBuilder::newSource(), optimizeBlock(), OptimizeExtractBits(), performBlockTailMerging(), llvm::PrepareToSplitEntryBlock(), ProcessBlock(), programUndefinedIfUndefOrPoison(), promoteMemoryToRegister(), reconnectPhis(), replaceArgumentUses(), restoreIPandDebugLoc(), RewriteUsesOfClonedInstructions(), llvm::IRBuilderBase::SetInsertPoint(), shouldInstrumentBlock(), llvm::SimplifyInstructionsInBlock(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), simplifyUsingControlFlow(), SinkCast(), sinkCmpExpression(), SinkShiftAndTruncate(), skipPastPhiNodesAndDbg(), skipToNonAllocaInsertPt(), splice(), llvm::JumpThreadingPass::threadEdge(), llvm::JumpThreadingPass::threadGuard(), llvm::JumpThreadingPass::threadThroughTwoBasicBlocks(), llvm::JumpThreadingPass::unfoldSelectInstr(), unswitchNontrivialInvariants(), unswitchTrivialBranch(), updateScopeLine(), llvm::InstVisitor< UnrolledInstAnalyzer, bool >::visit(), and workshareLoopTargetCallback().
Definition at line 473 of file BasicBlock.h.
Erases a range of instructions from FromIt to (not including) ToIt.
\Returns ToIt.
Definition at line 628 of file BasicBlock.cpp.
Referenced by llvm::MemorySSA::removeFromLookups().
Unlink 'this' from the containing function and delete it.
Definition at line 235 of file BasicBlock.cpp.
Referenced by analyzeAndPruneOutputBlocks(), llvm::CloneAndPruneIntoFromInst(), createSwitchStatement(), llvm::DomTreeUpdater::deleteBB(), llvm::InlineFunctionImpl(), and llvm::MergeBasicBlockIntoOnlyPred().
Eject any debug-info trailing at the end of a block.
DbgRecords can transiently be located "off the end" of a block if the blocks terminator is temporarily removed. Once a terminator is re-inserted this method will move such DbgRecords back to the right place (ahead of the terminator).
Definition at line 699 of file BasicBlock.cpp.
Referenced by llvm::changeToUnreachable().
Definition at line 483 of file BasicBlock.h.
Definition at line 482 of file BasicBlock.h.
Referenced by calculateStateNumbersForInvokes(), llvm::AAResults::canBasicBlockModify(), llvm::CloneAndPruneFunctionInto(), llvm::CloneAndPruneIntoFromInst(), llvm::FastISel::fastEmitBranch(), findArgParts(), formLCSSAForInstructionsImpl(), llvm::Function::front(), llvm::Function::front(), llvm::MustBeExecutedContextExplorer::getMustBeExecutedNextInstruction(), llvm::InstCombinerImpl::handlePotentiallyDeadBlocks(), insertCallAtFunctionEntryPoint(), llvm::ScalarEvolution::isBasicBlockEntryGuardedByCond(), isPotentiallyReachable(), llvm::coro::isSuspendBlock(), llvm::MergeBlockIntoPredecessor(), mergeCleanupPad(), mergeNestedCondBranch(), llvm::moveInstructionsToTheEnd(), movePHIValuesToInsertedBlock(), llvm::JumpThreadingPass::processBranchOnXOR(), llvm::removeAllNonTerminatorAndEHPadInstructions(), llvm::SSAUpdaterBulk::RewriteAllUses(), runSanitizeRealtimeBlocking(), llvm::SplitEdge(), splitLoopBound(), and llvm::TryToSimplifyUncondBranchFromEmptyBlock().
Get the context in which this basic block lives.
Definition at line 131 of file BasicBlock.cpp.
References llvm::dyn_cast().
Referenced by addBasicBlockMetadata(), llvm::addStringMetadataToLoop(), llvm::CloneBasicBlock(), llvm::JumpThreadingPass::cloneInstructions(), llvm::ConstantFoldTerminator(), llvm::EpilogueVectorizerMainLoop::createIterationCountCheck(), llvm::createMemCpyLoopKnownSize(), createMemMoveLoopKnownSize(), createMemMoveLoopUnknownSize(), createStringMetadata(), createUnreachableSwitchDefault(), llvm::ehAwareSplitEdge(), emptyAndDetachBlock(), findOrCreatePHIBlock(), llvm::BlockAddress::get(), llvm::sandboxir::BlockAddress::get(), llvm::DbgRecord::getContext(), llvm::DbgRecord::getContext(), llvm::VPlan::getContext(), llvm::BPFCoreSharedInfo::insertPassThrough(), llvm::BlockAddress::lookup(), llvm::sandboxir::BlockAddress::lookup(), llvm::lowerUnaryVectorIntrinsicAsLoop(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), mergeComparisons(), llvm::parseWidenableBranch(), llvm::JumpThreadingPass::processBranchOnXOR(), processSwitch(), llvm::SCCPSolver::removeNonFeasibleEdges(), removeUndefIntroducingPredecessor(), llvm::VPlanTransforms::replicateByVF(), rewritePHIsForCleanupPad(), llvm::Loop::setLoopAlreadyUnrolled(), llvm::Loop::setLoopMustProgress(), SimplifyCondBranchToCondBranch(), llvm::SplitBlockAndInsertIfThenElse(), SplitBlockPredecessorsImpl(), llvm::SplitCallBrEdge(), SplitLandingPadPredecessorsImpl(), splitLoopBound(), llvm::JumpThreadingPass::threadEdge(), llvm::JumpThreadingPass::threadThroughTwoBasicBlocks(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), llvm::JumpThreadingPass::unfoldSelectInstr(), and llvm::LoopVersioning::versionLoop().
Get the data layout of the module this basic block belongs to.
Requires the basic block to have a parent module.
Definition at line 252 of file BasicBlock.cpp.
Referenced by computeAllocaDefaultAlign(), computeLoadStoreDefaultAlign(), computeUnlikelySuccessors(), llvm::JumpThreadingPass::computeValueKnownInPredecessorsImpl(), llvm::EpilogueVectorizerMainLoop::createIterationCountCheck(), createWrapper(), llvm::JumpThreadingPass::duplicateCondBranchOnPHIIntoPred(), llvm::findAvailablePtrLoadStore(), llvm::MemoryDependenceResults::getNonLocalPointerDependency(), llvm::MemoryDependenceResults::getSimplePointerDependencyFrom(), llvm::getStartAndEndForAccess(), getStrideFromAddRec(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), llvm::JumpThreadingPass::maybethreadThroughTwoBasicBlocks(), llvm::LoopStructure::parseLoopStructure(), llvm::peelLoop(), llvm::JumpThreadingPass::processBlock(), llvm::JumpThreadingPass::processImpliedCondition(), llvm::promoteLoopAccessesToScalars(), reuseTableCompare(), llvm::simplifyCFG(), llvm::SimplifyInstructionsInBlock(), simplifyRecipe(), llvm::JumpThreadingPass::threadGuard(), and llvm::LoopVersioning::versionLoop().
Definition at line 331 of file BasicBlock.h.
References getFirstInsertionPt().
Returns an iterator to the first instruction in this block that is suitable for inserting a non-PHI instruction.
In particular, it skips all PHIs and LandingPad instructions.
Definition at line 393 of file BasicBlock.cpp.
Referenced by cloneInstructionInExitBlock(), llvm::ConvertDebugDeclareToDebugValue(), llvm::convertUsersOfConstantsToInstructions(), llvm::ConvergenceControlInst::CreateAnchor(), llvm::ConvergenceControlInst::CreateEntry(), llvm::ConvergenceControlInst::CreateLoop(), llvm::RandomIRBuilder::createStackMemory(), DbgInserterHelper(), llvm::VPReductionPHIRecipe::execute(), llvm::RandomIRBuilder::findOrCreateSource(), fixScalarResumeValuesFromBypass(), foldDependentIVs(), foldGuardedFunnelShift(), llvm::InstCombinerImpl::foldIntegerTypedPHI(), getFirstInsertionPt(), getInsertionRange(), getInsertPt(), getInsertPt(), getInstrBB(), llvm::coro::getSpillInsertionPt(), llvm::objcarc::BottomUpPtrState::HandlePotentialUse(), llvm::objcarc::BundledRetainClaimRVs::insertAfterInvokes(), llvm::insertDebugValuesForPHIs(), insertSpills(), llvm::SampleProfileProber::instrumentOneFunc(), llvm::invertCondition(), makeStatepointExplicitImpl(), mergeConditionalStoreToAddress(), llvm::InstCombinerImpl::mergeStoreIntoSuccessor(), llvm::InstDeleterIRStrategy::mutate(), llvm::ShuffleBlockStrategy::mutate(), llvm::RandomIRBuilder::newSource(), OptimizeExtractBits(), llvm::InstCombinerImpl::run(), setInsertionPoint(), shouldInstrumentBlock(), simplifyUsingControlFlow(), SinkCast(), sinkCmpExpression(), SinkInstruction(), sinkInstruction(), SinkShiftAndTruncate(), sinkUnusedInvariantsFromPreheaderToExit(), skipPastPhiNodesAndDbg(), llvm::SplitIndirectBrCriticalEdges(), SplitLandingPadPredecessorsImpl(), targetParallelCallback(), llvm::JumpThreadingPass::threadGuard(), llvm::InstCombinerImpl::tryToSinkInstruction(), and llvm::ObjectSizeOffsetEvaluator::visitPHINode().
Definition at line 350 of file BasicBlock.h.
Returns the first potential AsynchEH faulty instruction currently it checks for loads/stores (which may dereference a null pointer) and calls/invokes (which may propagate exceptions)
Definition at line 314 of file BasicBlock.cpp.
Definition at line 296 of file BasicBlock.h.
References getFirstNonPHIIt().
Returns an iterator to the first instruction in this block that is not a PHINode instruction.
When adding instructions to the beginning of the basic block, they should be added before the returned value, not before the first instruction, which might be PHI. Returns end() if there's no non-PHI instruction.
Avoid unwrapping the iterator to an Instruction* before inserting here, as important debug-info is preserved in the iterator.
Definition at line 337 of file BasicBlock.cpp.
Referenced by llvm::MachineFunction::addLandingPad(), llvm::calculateClrEHStateNumbers(), llvm::calculateCXXStateForAsynchEH(), llvm::calculateSEHStateForAsynchEH(), calculateStateNumbersForInvokes(), llvm::calculateWasmEHInfo(), canSplitPredecessors(), cloneInstructionInExitBlock(), CloneLoopBlocks(), cloneLoopBlocks(), llvm::colorEHFunclets(), ConnectEpilog(), connectEpilogueVectorLoop(), ConnectProlog(), llvm::objcarc::createCallInstWithColors(), llvm::createMemCpyLoopKnownSize(), createMemMoveLoopKnownSize(), createOutlinedFunction(), llvm::createPHIsForSplitLoopExit(), detectPopcountIdiom(), detectShiftUntilLessThanIdiom(), detectShiftUntilZeroIdiom(), llvm::ehAwareSplitEdge(), llvm::VPIRPhi::execute(), llvm::CodeExtractor::findOrCreateBlockForHoisting(), findPHIForConditionForwarding(), findUnwindDestinations(), getConvergenceEntry(), getFirstNonPHIIt(), getSuccPad(), getUnwindDestTokenHelper(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), HandleInlinedEHPad(), hoist(), llvm::InlineFunctionImpl(), llvm::insertDebugValuesForPHIs(), isEHPad(), LLVM_DEPRECATED(), markAliveBlocks(), moveLCSSAPhis(), populateEHOperandBundle(), preparePlanForEpilogueVectorLoop(), programUndefinedIfUndefOrPoison(), raiseUserConstantDataAllocasToEntryBlock(), relocationViaAlloca(), removeEmptyCleanup(), rewritePHIs(), llvm::InstCombinerImpl::run(), runMoveAutoInit(), llvm::SplitBlockAndInsertSimpleForLoop(), SplitLandingPadPredecessorsImpl(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), and llvm::UnrollLoop().
Definition at line 308 of file BasicBlock.h.
References getFirstNonPHIOrDbg().
Returns a pointer to the first instruction in this block that is not a PHINode or a debug intrinsic, or any pseudo operation if SkipPseudoOp is true.
Definition at line 354 of file BasicBlock.cpp.
Referenced by createOutlinedFunction(), llvm::OutlinableRegion::findCorrespondingBlockIn(), getFirstNonPHIOrDbg(), isPredicatedOnPHI(), llvm::moveInstructionsToTheBeginning(), NegateValue(), SplitBlockPredecessorsImpl(), and llvm::InstCombinerImpl::visitAllocaInst().
Definition at line 340 of file BasicBlock.h.
References getFirstNonPHIOrDbgOrAlloca().
Returns an iterator to the first instruction in this block that is not a PHINode, a debug intrinsic, a static alloca or any pseudo operation.
Definition at line 406 of file BasicBlock.cpp.
Referenced by llvm::InstCombinerImpl::freezeOtherUses(), getFirstNonPHIOrDbgOrAlloca(), getFreezeInsertPt(), and llvm::slpvectorizer::BoUpSLP::getSpillCost().
Definition at line 320 of file BasicBlock.h.
References getFirstNonPHIOrDbgOrLifetime().
Returns a pointer to the first instruction in this block that is not a PHINode, a debug intrinsic, or a lifetime intrinsic, or any pseudo operation if SkipPseudoOp is true.
Definition at line 372 of file BasicBlock.cpp.
Referenced by getFirstNonPHIOrDbgOrLifetime(), shouldInstrumentBlock(), and llvm::SplitKnownCriticalEdge().
Definition at line 669 of file BasicBlock.cpp.
Definition at line 717 of file BasicBlock.h.
Return the landingpad instruction associated with the landing pad.
Definition at line 665 of file BasicBlock.cpp.
Referenced by makeStatepointExplicitImpl(), and SplitLandingPadPredecessorsImpl().
Return the DbgMarker for the position given by It, so that DbgRecords can be inserted there.
This will either be nullptr if not present, a DbgMarker, or TrailingDbgRecords if It is end().
Definition at line 1047 of file BasicBlock.cpp.
Referenced by llvm::JumpThreadingPass::cloneInstructions(), formLCSSAForInstructionsImpl(), and RewriteUsesOfClonedInstructions().
Definition at line 221 of file BasicBlock.h.
Return the module owning the function this basic block belongs to, or nullptr if the function does not have a module.
Note: this is undefined behavior if the block does not have a parent.
Definition at line 248 of file BasicBlock.cpp.
Referenced by CanProveNotTakenFirstIteration(), llvm::RandomIRBuilder::connectToSink(), llvm::ConvergenceControlInst::CreateAnchor(), llvm::ConvergenceControlInst::CreateEntry(), llvm::ConvergenceControlInst::CreateLoop(), createOutlinedFunction(), llvm::LazyValueInfo::getConstant(), llvm::LazyValueInfo::getConstantOnEdge(), llvm::LazyValueInfo::getConstantRange(), llvm::LazyValueInfo::getConstantRangeOnEdge(), llvm::RISCVTargetLowering::getIRStackGuard(), llvm::LazyValueInfo::getPredicateOnEdge(), llvm::RandomIRBuilder::newSink(), llvm::RandomIRBuilder::newSource(), performBranchToCommonDestFolding(), print(), llvm::GCNTTIImpl::simplifyAMDGCNLaneIntrinsicDemanded(), and useTpOffset().
Return the DbgMarker for the position that comes after I.
Definition at line 1043 of file BasicBlock.cpp.
Definition at line 95 of file BasicBlock.h.
References assert(), and getParent().
Referenced by emitBasicBlockLoopComments(), llvm::FunctionLoweringInfo::getMBB(), llvm::GraphTraits< BasicBlock * >::getNumber(), llvm::GraphTraits< const BasicBlock * >::getNumber(), llvm::GraphTraits< Inverse< BasicBlock * > >::getNumber(), llvm::GraphTraits< Inverse< const BasicBlock * > >::getNumber(), PrintParentLoopComment(), and llvm::IRTranslator::runOnMachineFunction().
Definition at line 214 of file BasicBlock.h.
References Function.
Return the enclosing method, or null if none.
Definition at line 213 of file BasicBlock.h.
References Function.
Referenced by addReplicateRegions(), llvm::CodeMetrics::analyzeBasicBlock(), calculateCXXStateNumbers(), calculateSEHStateNumbers(), llvm::CanInlineCallSite(), canProveExitOnFirstIteration(), CanWidenIV(), checkOverflow(), llvm::JumpThreadingPass::cloneInstructions(), llvm::cloneLoopWithPreheader(), llvm::colorEHFunclets(), CompareValueComplexity(), computeAllocaDefaultAlign(), llvm::LoopSafetyInfo::computeBlockColors(), computeLoadStoreDefaultAlign(), convertToRelLookupTable(), convertValue(), copyMustTailReturn(), llvm::coro::BaseCloner::create(), createAllocaInstAtEntry(), llvm::IRSimilarity::IRSimilarityCandidate::createCanonicalRelationFrom(), llvm::createMemCpyLoopKnownSize(), createMemMoveLoopKnownSize(), createMemMoveLoopUnknownSize(), createMemSetLoop(), createUnreachableSwitchDefault(), DbgInserterHelper(), DoFlattenLoopPair(), llvm::ehAwareSplitEdge(), llvm::orc::IRSpeculationLayer::emit(), llvm::SITargetLowering::emitExpandAtomicAddrSpacePredicate(), llvm::HexagonTargetLowering::emitStoreConditional(), expandToSwitch(), llvm::CodeExtractor::extractCodeRegion(), llvm::CodeExtractor::findAllocas(), llvm::MustBeExecutedContextExplorer::findBackwardJoinPoint(), llvm::OutlinableRegion::findCorrespondingBlockIn(), llvm::MustBeExecutedContextExplorer::findForwardJoinPoint(), findOrCreatePHIBlock(), llvm::RandomIRBuilder::findOrCreateSource(), FlattenLoopPair(), llvm::InstCombinerImpl::foldAggregateConstructionIntoAggregateReuse(), llvm::foldBranchToCommonDest(), llvm::InstCombinerImpl::foldIntegerTypedPHI(), foldMemChr(), generateUnsignedDivisionCode(), llvm::BlockAddress::get(), llvm::BlockAddress::get(), llvm::AddrLabelMap::getAddrLabelSymbolToEmit(), getAllocaPos(), llvm::memtag::getAndroidSlotPtr(), llvm::TargetLoweringBase::getDefaultSafeStackPointerLocation(), llvm::BlockCoverageInference::getDependencies(), llvm::MemoryDependenceResults::getDependency(), getDominatees(), getDominators(), llvm::IRSimilarity::IRSimilarityCandidate::getEndBB(), llvm::memtag::getFP(), llvm::BlockAddress::getFunction(), llvm::DbgRecord::getFunction(), llvm::DbgRecord::getFunction(), llvm::IRSimilarity::IRSimilarityCandidate::getFunction(), llvm::Trace::getFunction(), llvm::ValueEnumerator::getGlobalBasicBlockID(), llvm::TargetLoweringBase::getIRStackGuard(), llvm::X86TargetLowering::getIRStackGuard(), llvm::Loop::getLocStr(), getModuleFromDPI(), llvm::MemoryDependenceResults::getNonLocalCallDependency(), getNumber(), llvm::sandboxir::Instruction::getParent(), llvm::memtag::getPC(), llvm::TargetLoweringBase::getSafeStackPointerLocation(), llvm::MemoryDependenceResults::getSimplePointerDependencyFrom(), llvm::slpvectorizer::BoUpSLP::getSpillCost(), llvm::IRSimilarity::IRSimilarityCandidate::getStartBB(), llvm::GCProjectionInst::getStatepoint(), HandleByValArgumentInit(), HandleInlinedEHPad(), HandleInlinedLandingPad(), llvm::InlineFunctionImpl(), insertBoundsCheck(), InsertCall(), InsertSafepointPoll(), insertSpills(), InsertTrap(), llvm::invertCondition(), llvm::Attributor::isAssumedDead(), llvm::ScalarEvolution::isBasicBlockEntryGuardedByCond(), isExplicitVecOuterLoop(), isFSqrtDivToFMulLegal(), llvm::isInTailCallPosition(), llvm::isPresplitCoroSuspendExitEdge(), LLVMInsertBasicBlockInContext(), LLVMInsertExistingBasicBlockAfterInsertBlock(), llvm::lowerUnaryVectorIntrinsicAsLoop(), memoryIsNotModifiedBetween(), llvm::MergeBasicBlockIntoOnlyPred(), mergeComparisons(), mergeCompatibleInvokesImpl(), moveLCSSAPhis(), llvm::InsertCFGStrategy::mutate(), llvm::InsertFunctionStrategy::mutate(), llvm::InsertPHIStrategy::mutate(), llvm::RandomIRBuilder::newSink(), llvm::RandomIRBuilder::newSource(), nullifySetjmp(), placeSplitBlockCarefully(), preparePlanForEpilogueVectorLoop(), llvm::PrepareToSplitEntryBlock(), llvm::printBasicBlock(), printBBName(), printIRBlockReference(), llvm::JumpThreadingPass::processBlock(), processSwitch(), programUndefinedIfUndefOrPoison(), llvm::memtag::readRegister(), llvm::SCCPSolver::removeNonFeasibleEdges(), llvm::RemoveRedundantDbgInstrs(), removeUndefIntroducingPredecessor(), replaceConstantExprOp(), replaceExtractElements(), rewritePHIsForCleanupPad(), scanOneBB(), llvm::BlockCoverageInference::shouldInstrumentBlock(), llvm::shouldOptimizeForSize(), SimplifyCondBranchToCondBranch(), simplifySwitchLookup(), sinkLifetimeStartMarkers(), sinkLoopInvariantInstructions(), sinkUnusedInvariantsFromPreheaderToExit(), skipPastPhiNodesAndDbg(), llvm::SplitBlockAndInsertIfThenElse(), llvm::SplitBlockAndInsertSimpleForLoop(), SplitBlockPredecessorsImpl(), llvm::SplitCallBrEdge(), llvm::SplitKnownCriticalEdge(), SplitLandingPadPredecessorsImpl(), llvm::SuspendCrossingInfo::SuspendCrossingInfo(), llvm::JumpThreadingPass::threadEdge(), llvm::JumpThreadingPass::threadThroughTwoBasicBlocks(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), llvm::JumpThreadingPass::tryToUnfoldSelectInCurrBB(), llvm::JumpThreadingPass::unfoldSelectInstr(), UpdateAnalysisInformation(), llvm::AddrLabelMap::UpdateForDeletedBlock(), UseTlsOffset(), and validateAndCostRequiredSelects().
Definition at line 257 of file BasicBlock.h.
Returns the call instruction calling @llvm.experimental.deoptimize that is present either in current basic block or in block that is a unique successor to current block, if such call is present.
Otherwise, returns null.
Definition at line 302 of file BasicBlock.cpp.
Definition at line 407 of file BasicBlock.h.
Return the predecessor of this block if it has a single predecessor block.
Otherwise return a null pointer.
Definition at line 437 of file BasicBlock.cpp.
Referenced by CanGenerateTest(), CanPropagatePredecessorsForPHIs(), CanProveNotTakenFirstIteration(), llvm::CloneAndPruneIntoFromInst(), connectEpilogueVectorLoop(), llvm::TileInfo::CreateTiledLoops(), llvm::EpilogueVectorizerEpilogueLoop::createVectorizedLoopSkeleton(), llvm::EpilogueVectorizerMainLoop::createVectorizedLoopSkeleton(), llvm::InnerLoopVectorizer::createVectorizedLoopSkeleton(), llvm::DominatorTree::dominates(), llvm::VPPredInstPHIRecipe::execute(), findDominatingValue(), findPHIForConditionForwarding(), FindWidenableTerminatorAboveLoop(), foldICmpWithDominatingICmp(), getDomPredecessorCondition(), llvm::GetIfCondition(), getOrderedBlocks(), handlePhiDef(), llvm::objcarc::BundledRetainClaimRVs::insertAfterInvokes(), llvm::ScalarEvolution::isBasicBlockEntryGuardedByCond(), llvm::SuspendCrossingInfo::isDefinitionAcrossSuspend(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), loadCSE(), llvm::JumpThreadingPass::maybeMergeBasicBlockIntoOnlyPred(), llvm::JumpThreadingPass::maybethreadThroughTwoBasicBlocks(), llvm::MergeBasicBlockIntoOnlyPred(), mergeBlocksIntoPredecessors(), mergeCleanupPad(), mergeConditionalStores(), mergeConditionalStoreToAddress(), llvm::JumpThreadingPass::processGuards(), llvm::JumpThreadingPass::processImpliedCondition(), recordConditions(), llvm::InstCombinerImpl::replacedSelectWithOperand(), shouldInstrumentBlock(), SimplifyCondBranchToCondBranch(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), llvm::SplitEdge(), tryToMoveFreeBeforeNullTest(), and llvm::TryToSimplifyUncondBranchFromEmptyBlock().
Definition at line 435 of file BasicBlock.h.
Return the successor of this block if it has a single successor.
Otherwise return a null pointer.
This method is analogous to getSinglePredecessor above.
Definition at line 467 of file BasicBlock.cpp.
Referenced by llvm::LoopVectorizationCostModel::collectValuesToIgnore(), llvm::TileInfo::CreateTiledLoops(), ensureValueAvailableInSuccessor(), llvm::VPlan::execute(), FindWidenableTerminatorAboveLoop(), isProfitableToTransform(), llvm::orc::SpeculateQuery::isStraightLine(), llvm::MergeBlockSuccessorsIntoGivenBlocks(), mergeConditionalStores(), optimizeDivRem(), processPhi(), programUndefinedIfUndefOrPoison(), sinkLifetimeStartMarkers(), llvm::UnrollLoop(), and llvm::UnrollRuntimeLoopRemainder().
Definition at line 247 of file BasicBlock.h.
Returns the call instruction calling @llvm.experimental.deoptimize prior to the terminating return instruction of this basic block, if such a call is present.
Otherwise, returns null.
Definition at line 287 of file BasicBlock.cpp.
Referenced by llvm::IsBlockFollowedByDeoptOrUnreachable(), tryWidenCondBranchToCondBranch(), and violatesLegacyMultiExitLoopCheck().
Definition at line 266 of file BasicBlock.h.
Returns the call instruction marked 'musttail' prior to the terminating return instruction of this basic block, if such a call is present.
Otherwise, returns null.
Definition at line 256 of file BasicBlock.cpp.
Referenced by getEffectiveTerminator(), and llvm::EscapeEnumerator::Next().
Definition at line 238 of file BasicBlock.h.
Returns the terminator instruction if the block is well formed or null if the block is not well formed.
Definition at line 233 of file BasicBlock.h.
References const, and LLVM_READONLY.
Referenced by addBasicBlockMetadata(), Prefetch::addInstruction(), addNoUndefAttrs(), llvm::CodeMetrics::analyzeBasicBlock(), analyzeLoopUnrollCost(), basicBlockCanReturn(), llvm::BranchProbabilityInfo::calculate(), llvm::calculateCXXStateForAsynchEH(), llvm::calculateSEHStateForAsynchEH(), canFoldTermCondOfLoop(), llvm::canPeelLastIteration(), canSplitLoopBound(), checkBasicSSA(), checkOverflow(), llvm::CloneAndPruneIntoFromInst(), llvm::CloneFunctionBodyInto(), cloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(), CloneLoopBlocks(), cloneLoopBlocks(), llvm::colorEHFunclets(), llvm::FunctionComparator::compare(), ComputeNumSignBitsImpl(), ComputePostOrders(), computeUnlikelySuccessors(), ConnectEpilog(), connectEpilogueVectorLoop(), ConnectProlog(), llvm::VPBasicBlock::connectToPredecessors(), llvm::ConstantFoldTerminator(), copyMustTailReturn(), llvm::coro::BaseCloner::create(), createCondBranch(), createFoldedExitCond(), createInvariantCond(), llvm::EpilogueVectorizerMainLoop::createIterationCountCheck(), llvm::createMemCpyLoopKnownSize(), createMemMoveLoopKnownSize(), createMemMoveLoopUnknownSize(), createMemSetLoop(), llvm::createPHIsForSplitLoopExit(), createReplacement(), llvm::createSanitizerCtorAndInitFunctions(), llvm::InnerLoopVectorizer::createScalarPreheader(), createSwitchStatement(), llvm::VPlan::createVPIRBasicBlock(), despeculateCountZeros(), detectPopcountIdiom(), detectShiftUntilBitTestIdiom(), detectShiftUntilLessThanIdiom(), detectShiftUntilZeroIdiom(), detectShiftUntilZeroIdiom(), DoFlattenLoopPair(), dominatesMergePoint(), llvm::JumpThreadingPass::duplicateCondBranchOnPHIIntoPred(), llvm::DuplicateInstructionsInSplitBetween(), llvm::ehAwareSplitEdge(), llvm::EpilogueVectorizerMainLoop::emitIterationCountCheck(), emptyAndDetachBlock(), llvm::Evaluator::EvaluateFunction(), llvm::VPFirstOrderRecurrencePHIRecipe::execute(), llvm::VPlan::execute(), llvm::VPlanTransforms::expandSCEVs(), expandToSwitch(), findBasePointer(), llvm::orc::SpeculateQuery::findCalles(), findDominatingValue(), findLoopComponents(), FindLoopCounter(), llvm::DominatorTree::findNearestCommonDominator(), llvm::RandomIRBuilder::findOrCreateSource(), findPHIForConditionForwarding(), fixupDebugInfoPostExtraction(), FlattenLoopPair(), llvm::InstCombinerImpl::foldBinopWithPhiOperands(), foldCondBranchOnValueKnownInPredecessorImpl(), foldExit(), llvm::InstCombinerImpl::foldFreezeIntoRecurrence(), foldGuardedFunnelShift(), foldICmpWithDominatingICmp(), foldMemChr(), llvm::InstCombinerImpl::foldOpIntoPhi(), generateUnsignedDivisionCode(), genLoopLimit(), getBestDestForJumpOnUndef(), getBranchHint(), getBranchInsertPoint(), llvm::Loop::LoopBounds::getCanonicalPredicate(), getDomPredecessorCondition(), getEffectiveTerminator(), getEHPadFromPredecessor(), getEndIterator(), getExpectedExitLoopLatchBranch(), llvm::DenseMapInfo< const SwitchSuccWrapper * >::getHashValue(), llvm::GetIfCondition(), getInsertPointForUses(), getInstrBB(), getJumpThreadDuplicationCost(), getKnownValueOnEdge(), llvm::Loop::getLoopGuardBranch(), llvm::RegionTraits< Function >::getNumSuccessors(), getOnlyLiveSuccessor(), getOuterLoopLatchCmp(), llvm::ProfileAnnotator::getOutgoingBranchWeights(), getOutliningBenefit(), getOutliningPenalty(), VectorSlice::getSlicedVal(), llvm::slpvectorizer::BoUpSLP::getSpillCost(), llvm::coro::getSpillInsertionPt(), llvm::GCProjectionInst::getStatepoint(), getStrlenWithNull(), llvm::GetSuccessorNumber(), getSuccState(), llvm::coro::BaseCloner::handleFinalSuspend(), handleNBranch(), handlePhiDef(), llvm::InstCombinerImpl::handleUnreachableFrom(), hasSideeffectFreeStaticResolution(), hoist(), hoistAdd(), llvm::hoistAllInstructionsInto(), hoistBOAssociation(), hoistGEP(), hoistMinMax(), hoistMulAddAssociation(), llvm::hoistRegion(), hoistSub(), injectPendingInvariantConditions(), llvm::InlineFunctionImpl(), insertBoundsCheck(), llvm::DIBuilder::insertDeclare(), insertUniqueBackedgeBlock(), llvm::SampleProfileProber::instrumentOneFunc(), llvm::Attributor::isAssumedDead(), llvm::IsBlockFollowedByDeoptOrUnreachable(), isChainSelectCmpBranch(), llvm::SparseSolver< LatticeKey, LatticeVal, KeyInfo >::isEdgeFeasible(), llvm::isInlineViable(), llvm::isInTailCallPosition(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), isLoopDead(), isLoopExitTestBasedOn(), isNotUsedOrFoldableInLoop(), isPowerOfTwoRecurrence(), isSafePHIToSpeculate(), llvm::isSafeToMoveBefore(), llvm::isUniformLoop(), isUniformlyReached(), llvm::lowerUnaryVectorIntrinsicAsLoop(), llvm::Loop::makeLoopInvariant(), llvm::JumpThreadingPass::maybeMergeBasicBlockIntoOnlyPred(), llvm::JumpThreadingPass::maybethreadThroughTwoBasicBlocks(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), mergeConditionalStoreToAddress(), mergeNestedCondBranch(), llvm::InstCombinerImpl::mergeStoreIntoSuccessor(), moveBBContents(), llvm::moveInstructionsToTheEnd(), llvm::MemorySSAUpdater::moveToPlace(), needsLFTR(), llvm::RandomIRBuilder::newSource(), llvm::EscapeEnumerator::Next(), optimizeDivRem(), llvm::slpvectorizer::BoUpSLP::optimizeGatherSequence(), OptimizeNonTrivialIFuncs(), optimizeSQRT(), llvm::LoopStructure::parseLoopStructure(), llvm::peelLoop(), peelToTurnInvariantLoadsDerefencebale(), performBranchToCommonDestFolding(), llvm::InstCombinerImpl::prepareWorklist(), llvm::JumpThreadingPass::processBlock(), llvm::JumpThreadingPass::processBranchOnPHI(), llvm::JumpThreadingPass::processImpliedCondition(), llvm::JumpThreadingPass::processThreadableEdges(), llvm::promoteLoopAccessesToScalars(), llvm::OutlinableRegion::reattachCandidate(), llvm::HashRecognize::recognizeCRC(), recordCondition(), redirectToHub(), llvm::removeAllNonTerminatorAndEHPadInstructions(), llvm::MemorySSAUpdater::removeBlocks(), llvm::SCCPSolver::removeNonFeasibleEdges(), removeUndefIntroducingPredecessor(), llvm::removeUnwindEdge(), replaceBranchTargets(), replaceConstantExprOp(), replaceIfBranchTargets(), rewriteMaterializableInstructions(), rewriteMemOpOfSelect(), rewritePHIs(), llvm::InstCombinerImpl::run(), llvm::LoopConstrainer::run(), llvm::PlaceSafepointsPass::runImpl(), llvm::SLPVectorizerPass::runImpl(), RunTermFold(), scalarizeMaskedCompressStore(), scalarizeMaskedExpandLoad(), scalarizeMaskedGather(), scalarizeMaskedLoad(), scalarizeMaskedScatter(), scalarizeMaskedStore(), scalarizeMaskedVectorHistogram(), separateNestedLoop(), llvm::SSPLayoutInfo::shouldEmitSDCheck(), shouldUnrollMultiExitLoop(), simplifyInstructionWithPHI(), simplifyOneLoop(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), SinkCast(), sinkLastInstruction(), sinkUnusedInvariantsFromPreheaderToExit(), splitBeforeCatchSwitch(), llvm::SplitBlockAndInsertIfElse(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), llvm::SplitBlockAndInsertIfThenElse(), llvm::SplitBlockAndInsertSimpleForLoop(), SplitBlockPredecessorsImpl(), llvm::SplitCallBrEdge(), llvm::SplitEdge(), llvm::SplitIndirectBrCriticalEdges(), splitLoopBound(), llvm::succ_begin(), llvm::succ_begin(), llvm::succ_end(), llvm::succ_end(), swapBBContents(), threadBinOpOverPHI(), threadCmpOverPHI(), llvm::JumpThreadingPass::threadEdge(), llvm::JumpThreadingPass::threadThroughTwoBasicBlocks(), llvm::JumpThreadingPass::tryThreadEdge(), tryToMoveFreeBeforeNullTest(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), llvm::InstCombinerImpl::tryToSinkInstruction(), llvm::JumpThreadingPass::tryToUnfoldSelect(), llvm::JumpThreadingPass::tryToUnfoldSelectInCurrBB(), tryUnmergingGEPsAcrossIndirectBr(), turnGuardIntoBranch(), turnSelectIntoBranch(), turnToExplicitForm(), unifyLoopExits(), llvm::UnrollAndJamLoop(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopRemainder(), unswitchAllTrivialConditions(), unswitchNontrivialInvariants(), unswitchTrivialBranch(), unswitchTrivialSwitch(), updatePredecessorProfileMetadata(), llvm::LoopVersioning::versionLoop(), violatesLegacyMultiExitLoopCheck(), llvm::InstCombinerImpl::visitPHINode(), and workshareLoopTargetCallback().
Fetch the collection of DbgRecords that "trail" after the last instruction of this block, see setTrailingDbgRecords.
If there are none, returns nullptr.
Definition at line 1128 of file BasicBlock.cpp.
Definition at line 419 of file BasicBlock.h.
Return the predecessor of this block if it has a unique predecessor block.
Otherwise return a null pointer.
Note that unique predecessor doesn't mean single edge, there can be multiple edges from the unique predecessor to this block (for example a switch statement with multiple cases having the same destination).
Definition at line 445 of file BasicBlock.cpp.
Referenced by areInnerLoopLatchPHIsSupported(), areOuterLoopExitPHIsSupported(), llvm::MustBeExecutedContextExplorer::findBackwardJoinPoint(), findLocationForEntrySafepoint(), llvm::Loop::getLoopGuardBranch(), IsAcceptableTarget(), makeStatepointExplicitImpl(), llvm::MergeBlockIntoPredecessor(), llvm::MergeBlockSuccessorsIntoGivenBlocks(), llvm::MemorySSAUpdater::moveAllAfterMergeBlocks(), normalizeForInvokeSafepoint(), optimizeDivRem(), reuseTableCompare(), llvm::InstCombinerImpl::run(), runMoveAutoInit(), llvm::LoopNest::skipEmptyBlockUntil(), llvm::InstCombinerImpl::tryToSinkInstruction(), and llvm::UnrollLoop().
Definition at line 445 of file BasicBlock.h.
Return the successor of this block if it has a unique successor.
Otherwise return a null pointer.
This method is analogous to getUniquePredecessor above.
Definition at line 475 of file BasicBlock.cpp.
Referenced by llvm::MustBeExecutedContextExplorer::findForwardJoinPoint(), IsBackEdge(), llvm::IsBlockFollowedByDeoptOrUnreachable(), llvm::MergeBlockIntoPredecessor(), llvm::OutlinableRegion::reattachCandidate(), llvm::LoopNest::skipEmptyBlockUntil(), and tryToMergeLandingPad().
Returns a pointer to the symbol table if one exists.
Definition at line 125 of file BasicBlock.cpp.
Returns true if there are any uses of this basic block other than direct branches, switches, etc.
to it.
Definition at line 690 of file BasicBlock.h.
References llvm::Value::SubclassOptionalData.
Referenced by llvm::CloneAndPruneIntoFromInst(), llvm::AsmPrinter::emitBasicBlockStart(), foldTwoEntryPHINode(), llvm::AddrLabelMap::getAddrLabelSymbolToEmit(), getOrderedBlocks(), hasAddressTakenAndUsed(), isBlockValidForExtraction(), llvm::isInlineViable(), llvm::BlockAddress::lookup(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), and llvm::IRTranslator::runOnMachineFunction().
Return true if this block has exactly N predecessors.
Definition at line 459 of file BasicBlock.cpp.
Referenced by ensureValueAvailableInSuccessor(), introduceTooManyPhiEntries(), llvm::InstCombinerImpl::mergeStoreIntoSuccessor(), llvm::JumpThreadingPass::processThreadableEdges(), and llvm::MemorySSAUpdater::wireOldPredecessorsToNewImmediatePredecessor().
Return true if this block has N predecessors or more.
Definition at line 463 of file BasicBlock.cpp.
Referenced by CanRedirectPredsOfEmptyBBToSucc().
Insert a DbgRecord into a block at the position given by I.
Definition at line 1027 of file BasicBlock.cpp.
Referenced by DbgInserterHelper().
Insert a DbgRecord into a block at the position given by Here.
Definition at line 1035 of file BasicBlock.cpp.
Referenced by DbgInserterHelper(), llvm::insertDebugValuesForPHIs(), and llvm::DIBuilder::insertLabel().
Insert unlinked basic block into a function.
Inserts an unlinked basic block into Parent. If InsertBefore is provided, inserts before that basic block, otherwise inserts at the end.
nullptr. Definition at line 158 of file BasicBlock.cpp.
Referenced by moveFunctionAdaptingType().
Return an iterator range over the instructions in the block, skipping any debug instructions.
Skip and any pseudo operations as well if SkipPseudoOp is true.
Definition at line 216 of file BasicBlock.cpp.
Return a const iterator range over the instructions in the block, skipping any debug instructions.
Skip any pseudo operations as well if SkipPseudoOp is true.
Definition at line 206 of file BasicBlock.cpp.
Referenced by blockIsSimpleEnoughToThreadThrough(), llvm::ir2vec::Embedder::computeEmbeddings(), llvm::orc::SpeculateQuery::findCalles(), getCaseResults(), getOutliningBenefit(), isSafeToSpeculateStore(), mergeConditionalStoreToAddress(), SimplifyCondBranchToCondBranch(), and tryToMoveFreeBeforeNullTest().
Mark instruction ordering invalid. Done on every instruction insert.
Definition at line 737 of file BasicBlock.h.
References llvm::Value::SubclassOptionalData, and validateInstrOrdering().
Return true if this basic block is an exception handling block.
Definition at line 707 of file BasicBlock.h.
References getFirstNonPHIIt().
Referenced by calculateCXXStateNumbers(), calculateSEHStateNumbers(), llvm::calculateWasmEHInfo(), canSplitCallSite(), deleteLoopIfDead(), getPredState(), IsAcceptableTarget(), llvm::JumpThreadingPass::maybethreadThroughTwoBasicBlocks(), llvm::InstModificationIRStrategy::mutate(), llvm::JumpThreadingPass::processBranchOnXOR(), llvm::SLPVectorizerPass::runImpl(), llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad(), and llvm::SplitKnownCriticalEdge().
Return true if this is the entry block of the containing function.
This method can only be used on blocks that have a parent function.
Definition at line 549 of file BasicBlock.cpp.
Referenced by llvm::SelectionDAGBuilder::isExportableFromCurrentBlock(), llvm::isPotentiallyReachable(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::InstCombinerImpl::prepareWorklist(), llvm::printBasicBlock(), printBBName(), llvm::RemoveRedundantDbgInstrs(), removeRedundantDbgLocs(), removeUndefDbgAssignsFromEntryBlock(), removeUndefDbgLocsFromEntryBlock(), and UpdateAnalysisInformation().
Returns true if the Order field of child Instructions is valid.
Definition at line 732 of file BasicBlock.h.
References llvm::Value::SubclassOptionalData.
Return true if this basic block is a landing pad.
Being a `‘landing pad’' means that the basic block is the destination of the 'unwind' edge of an invoke instruction.
Definition at line 661 of file BasicBlock.cpp.
Referenced by llvm::createPHIsForSplitLoopExit(), mergeCompatibleInvokes(), SplitBlockPredecessorsImpl(), and SplitLandingPadPredecessorsImpl().
Return true if it is legal to hoist instructions into this block.
Definition at line 535 of file BasicBlock.cpp.
References const, getFirstNonPHIIt(), LLVM_ABI, and LLVM_DEPRECATED().
Returns a pointer to the first instruction in this block that is not a PHINode instruction.
When adding instructions to the beginning of the basic block, they should be added before the returned value, not before the first instruction, which might be PHI. Returns 0 is there's no non-PHI instruction.
Deprecated in favour of getFirstNonPHIIt, which returns an iterator that preserves some debugging information.
References const, and LLVM_ABI.
Referenced by LLVM_DEPRECATED().
Unlink this basic block from its current function and insert it right after MovePos in the function MovePos lives in.
Definition at line 243 of file BasicBlock.cpp.
Referenced by InsertStackProtectors(), llvm::MergeBasicBlockIntoOnlyPred(), placeSplitBlockCarefully(), llvm::sortBlocks(), llvm::JumpThreadingPass::threadEdge(), and llvm::JumpThreadingPass::threadThroughTwoBasicBlocks().
Unlink this basic block from its current function and insert it into the function that MovePos lives in, right before MovePos.
Definition at line 386 of file BasicBlock.h.
References llvm::ilist_node_impl< OptionsT >::getIterator(), and moveBefore().
Referenced by buildClonedLoopBlocks(), llvm::CloneAndPruneIntoFromInst(), and moveBefore().
Definition at line 239 of file BasicBlock.cpp.
References LLVM_ABI.
Definition at line 489 of file BasicBlock.cpp.
Returns a range that iterates over the phis in the basic block.
Note that this cannot be used with basic blocks that have no terminator.
Definition at line 528 of file BasicBlock.h.
References phis().
Referenced by llvm::InstCombinerImpl::addDeadEdge(), addPHINodeEntriesForMappedBlock(), addPredecessorToBlock(), analyzeExitPHIsForOutputUses(), areInnerLoopExitPHIsSupported(), areInnerLoopLatchPHIsSupported(), areOuterLoopExitPHIsSupported(), CanRedirectPredsOfEmptyBBToSucc(), checkPHIs(), llvm::LoopVectorizationCostModel::collectValuesToIgnore(), ConnectEpilog(), connectEpilogueVectorLoop(), llvm::createPHIsForSplitLoopExit(), llvm::DeleteDeadPHIs(), deleteLoopIfDead(), llvm::EliminateDuplicatePHINodes(), EliminateNewDuplicatePHINodes(), findOrCreatePHIInBlock(), findPHIForConditionForwarding(), fixScalarResumeValuesFromBypass(), fixSuccessorPhis(), fixupPHINodeForNormalDest(), fixupPHINodeForUnwindDest(), forwardSwitchConditionToPHI(), llvm::DenseMapInfo< const SwitchSuccWrapper * >::getHashValue(), getRecurrences(), llvm::SSAUpdater::GetValueInMiddleOfBlock(), HandleInlinedEHPad(), incomingValuesAreCompatible(), introduceTooManyPhiEntries(), llvm::DenseMapInfo< const SwitchSuccWrapper * >::isEqual(), isExistingPhi(), isLoopDead(), isPredicatedOnPHI(), isSafeToHoistInvoke(), llvm::MergeBlockIntoPredecessor(), moveLCSSAPhis(), phis(), removeEmptyCleanup(), removeUndefIntroducingPredecessor(), replaceTargetsFromPHINode(), rewritePHINodesForExitAndUnswitchedBlocks(), rewritePHINodesForUnswitchedExitBlock(), SimplifyCondBranchToCondBranch(), simplifyLCSSAPhis(), sinkCommonCodeFromPredecessors(), splitCallSite(), splitLoopBound(), tryWidenCondBranchToCondBranch(), llvm::UnrollLoop(), llvm::updatePhiNodes(), and validateAndCostRequiredSelects().
Print the basic block to an output stream with an optional AssemblyAnnotationWriter.
Definition at line 5023 of file AsmWriter.cpp.
References getModule(), and getParent().
Referenced by llvm::DOTGraphTraits< DOTFuncMSSAInfo * >::getNodeLabel().
Definition at line 475 of file BasicBlock.h.
Referenced by findLiveSetAtInst().
Definition at line 476 of file BasicBlock.h.
In rare circumstances instructions can be speculatively removed from blocks, and then be re-inserted back into that position later.
When this happens in RemoveDIs debug-info mode, some special patching-up needs to occur: inserting into the middle of a sequence of dbg.value intrinsics does not have an equivalent with DbgRecords.
Definition at line 1055 of file BasicBlock.cpp.
Unlink 'this' from the containing function, but do not delete it.
Definition at line 231 of file BasicBlock.cpp.
Referenced by llvm::DomTreeUpdater::callbackDeleteBB(), and moveFunctionAdaptingType().
Update PHI nodes in this BasicBlock before removal of predecessor Pred.
Note that this function does not actually remove the predecessor.
If KeepOneInputPHIs is true then don't remove PHIs that are left with zero or one incoming values, and don't simplify PHIs with all incoming values the same.
Definition at line 494 of file BasicBlock.cpp.
Referenced by llvm::changeToCall(), llvm::ConstantFoldTerminator(), llvm::JumpThreadingPass::duplicateCondBranchOnPHIIntoPred(), foldCondBranchOnValueKnownInPredecessorImpl(), llvm::FoldReturnIntoUncondBranch(), HandleInlinedEHPad(), HandleInlinedLandingPad(), markAliveBlocks(), mergeNestedCondBranch(), llvm::JumpThreadingPass::processBlock(), llvm::JumpThreadingPass::processImpliedCondition(), processSwitch(), redirectTo(), removeEmptyCleanup(), llvm::SCCPSolver::removeNonFeasibleEdges(), removeSwitchAfterSelectFold(), removeUndefIntroducingPredecessor(), llvm::removeUnwindEdge(), simplifyOneLoop(), simplifySwitchLookup(), simplifySwitchOfCmpIntrinsic(), llvm::SplitKnownCriticalEdge(), llvm::JumpThreadingPass::threadEdge(), llvm::JumpThreadingPass::threadThroughTwoBasicBlocks(), tryToMergeLandingPad(), tryWidenCondBranchToCondBranch(), llvm::UnrollLoop(), unswitchNontrivialInvariants(), and unswitchTrivialSwitch().
Definition at line 477 of file BasicBlock.h.
Referenced by llvm::FindAvailableLoadedValue(), and splitCallSite().
Definition at line 478 of file BasicBlock.h.
Renumber instructions and mark the ordering as valid.
Definition at line 688 of file BasicBlock.cpp.
Update all phi nodes in this basic block to refer to basic block New instead of basic block Old.
Definition at line 635 of file BasicBlock.cpp.
Referenced by moveLCSSAPhis(), and llvm::SplitCallBrEdge().
Update all phi nodes in this basic block's successors to refer to basic block New instead of to it.
Definition at line 657 of file BasicBlock.cpp.
Update all phi nodes in this basic block's successors to refer to basic block New instead of basic block Old.
Definition at line 646 of file BasicBlock.cpp.
Referenced by llvm::OutlinableRegion::reattachCandidate().
Record that the collection of DbgRecords in M "trails" after the last instruction of this block.
These are equivalent to dbg.value intrinsics that exist at the end of a basic block with no terminator (a transient state that occurs regularly).
Definition at line 1124 of file BasicBlock.cpp.
Referenced by llvm::DbgMarker::removeMarker().
Definition at line 480 of file BasicBlock.h.
Referenced by analyzeAndPruneOutputBlocks(), containsUnreachable(), createSwitchStatement(), emptyAndDetachBlock(), findDuplicateOutputBlock(), getCaseResults(), llvm::DenseMapInfo< const SwitchSuccWrapper * >::getHashValue(), llvm::slpvectorizer::BoUpSLP::getSpillCost(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::moveInstructionsToTheEnd(), remapOperands(), replaceIfBranchTargets(), tryToMoveFreeBeforeNullTest(), and unswitchTrivialSwitch().
Return the size of the basic block ignoring debug instructions.
Definition at line 226 of file BasicBlock.cpp.
Transfer all instructions from FromBB to this basic block at ToIt.
Definition at line 662 of file BasicBlock.h.
References begin(), end(), and splice().
Referenced by llvm::hoistAllInstructionsInto(), llvm::InlineFunctionImpl(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), moveBBContents(), moveBBContents(), splice(), splice(), llvm::TryToSimplifyUncondBranchFromEmptyBlock(), and workshareLoopTargetCallback().
Transfer a range of instructions that belong to FromBB from FromBeginIt to FromEndIt, to this basic block at ToIt.
Definition at line 1003 of file BasicBlock.cpp.
Transfer one instruction from FromBB at FromIt to this basic block at ToIt.
Definition at line 668 of file BasicBlock.h.
References splice().
Definition at line 633 of file BasicBlock.h.
References I, and splitBasicBlock().
Split the basic block into two basic blocks at the specified instruction.
If Before is true, splitBasicBlockBefore handles the block splitting. Otherwise, execution proceeds as described below.
Note that all instructions BEFORE the specified iterator stay as part of the original basic block, an unconditional branch is added to the original BB, and the rest of the instructions in the BB are moved to the new BB, including the old terminator. The newly formed basic block is returned. This function invalidates the specified iterator.
Note that this only works on well formed basic blocks (must have a terminator), and 'I' must not be the end of instruction list (which would cause a degenerate basic block to be formed, having a terminator inside of the basic block).
Also note that this doesn't preserve any passes. To split blocks while keeping loop information consistent, use the SplitBlock utility function.
Definition at line 555 of file BasicBlock.cpp.
Referenced by llvm::coro::BaseCloner::create(), llvm::createMemCpyLoopKnownSize(), createMemMoveLoopKnownSize(), createMemSetLoop(), despeculateCountZeros(), llvm::SITargetLowering::emitExpandAtomicAddrSpacePredicate(), expandFPToI(), expandIToFP(), llvm::CodeExtractor::findOrCreateBlockForHoisting(), generateUnsignedDivisionCode(), getStrlenWithNull(), llvm::coro::BaseCloner::handleFinalSuspend(), handleNBranch(), llvm::InlineFunctionImpl(), insertBoundsCheck(), insertSpills(), llvm::lowerUnaryVectorIntrinsicAsLoop(), splitBasicBlock(), splitBeforeCatchSwitch(), llvm::SplitBlockAndInsertIfThenElse(), llvm::splitBlockBefore(), and SplitBlockImpl().
Definition at line 657 of file BasicBlock.h.
References I, and splitBasicBlockBefore().
Split the basic block into two basic blocks at the specified instruction and insert the new basic blocks as the predecessor of the current block.
This function ensures all instructions AFTER and including the specified iterator I are part of the original basic block. All Instructions BEFORE the iterator I are moved to the new BB and an unconditional branch is added to the new BB. The new basic block is returned.
Note that this only works on well formed basic blocks (must have a terminator), and 'I' must not be the end of instruction list (which would cause a degenerate basic block to be formed, having a terminator inside of the basic block). 'I' cannot be a iterator for a PHINode with multiple incoming blocks.
Also note that this doesn't preserve any passes. To split blocks while keeping loop information consistent, use the SplitBlockBefore utility function.
Definition at line 589 of file BasicBlock.cpp.
Referenced by splitBasicBlockBefore().
Asserts that instruction order numbers are marked invalid, or that they are in ascending order.
In asserts builds, this checks the numbering.
This is constant time if the ordering is invalid, and linear in the number of instructions if the ordering is valid. Callers should be careful not to call this in ways that make common operations O(n^2). For example, it takes O(n) time to assign order numbers to instructions, so the order should be validated no more than once after each ordering to ensure that transforms have the same algorithmic complexity when asserts are enabled as when they are disabled.
In non-asserts builds, it is defined as a no-op inline function in BasicBlock.h.
Definition at line 1112 of file BasicBlock.cpp.
Referenced by invalidateOrders().
Definition at line 73 of file BasicBlock.h.
References BlockAddress, Function, I, and LLVM_ABI.
Referenced by BlockAddress.
Definition at line 69 of file BasicBlock.h.
References Function.
Referenced by BlockAddress, convertToNewDbgValues(), Function, getParent(), and getParent().
References llvm::Instruction::cloneDebugInfoFrom().
Referenced by llvm::Function::BasicBlock::eraseFromParent.
References llvm::Instruction::insertAfter().
References llvm::Instruction::insertAfter().
References llvm::Instruction::insertBefore().
References llvm::Instruction::insertBefore().
Referenced by llvm::Function::BasicBlock::removeFromParent.
Definition at line 178 of file BasicBlock.h.
Definition at line 178 of file BasicBlock.h.
Definition at line 73 of file BasicBlock.h.