LLVM 17.0.0git
Functions | Variables
BasicBlockSections.cpp File Reference
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/CodeGen/BasicBlockSectionUtils.h"
#include "llvm/CodeGen/BasicBlockSectionsProfileReader.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/InitializePasses.h"
#include "llvm/Target/TargetMachine.h"
#include <optional>

Go to the source code of this file.

Functions

 INITIALIZE_PASS (BasicBlockSections, "bbsections-prepare", "Prepares for basic block sections, by splitting functions " "into clusters of basic blocks.", false, false) static void updateBranches(MachineFunction &MF
 
 for (auto &MBB :MF)
 
bool getBBClusterInfoForFunction (const MachineFunction &MF, BasicBlockSectionsProfileReader *BBSectionsProfileReader, DenseMap< unsigned, BBClusterInfo > &V)
 
static void assignSections (MachineFunction &MF, const DenseMap< unsigned, BBClusterInfo > &FuncBBClusterInfo)
 
static bool hasInstrProfHashMismatch (MachineFunction &MF)
 

Variables

static cl::opt< boolBBSectionsDetectSourceDrift ("bbsections-detect-source-drift", cl::desc("This checks if there is a fdo instr. profile hash " "mismatch for this function"), cl::init(true), cl::Hidden)
 
const SmallVector< MachineBasicBlock * > & PreLayoutFallThroughs
 
SmallVector< MachineOperand, 4 > Cond
 

Function Documentation

◆ assignSections()

static void assignSections ( MachineFunction MF,
const DenseMap< unsigned, BBClusterInfo > &  FuncBBClusterInfo 
)
static

◆ for()

for ( auto &MBB :MF   )

◆ getBBClusterInfoForFunction()

bool getBBClusterInfoForFunction ( const MachineFunction MF,
BasicBlockSectionsProfileReader BBSectionsProfileReader,
DenseMap< unsigned, BBClusterInfo > &  V 
)

◆ hasInstrProfHashMismatch()

static bool hasInstrProfHashMismatch ( MachineFunction MF)
static

◆ INITIALIZE_PASS()

INITIALIZE_PASS ( BasicBlockSections  ,
"bbsections-prepare"  ,
"Prepares for basic block  sections,
by splitting functions " "into clusters of basic blocks."  ,
false  ,
false   
) &

Variable Documentation

◆ BBSectionsDetectSourceDrift

cl::opt< bool > BBSectionsDetectSourceDrift("bbsections-detect-source-drift", cl::desc("This checks if there is a fdo instr. profile hash " "mismatch for this function"), cl::init(true), cl::Hidden) ( "bbsections-detect-source-drift"  ,
cl::desc("This checks if there is a fdo instr. profile hash " "mismatch for this function")  ,
cl::init(true ,
cl::Hidden   
)
static

◆ Cond

Definition at line 137 of file BasicBlockSections.cpp.

Referenced by addConditions(), llvm::addPredicatedMveVpredNOp(), llvm::addPredicatedMveVpredROp(), llvm::R600InstrInfo::analyzeBranch(), llvm::ARCInstrInfo::analyzeBranch(), llvm::BPFInstrInfo::analyzeBranch(), llvm::HexagonInstrInfo::analyzeBranch(), llvm::LoongArchInstrInfo::analyzeBranch(), llvm::M68kInstrInfo::analyzeBranch(), llvm::MipsInstrInfo::analyzeBranch(), llvm::MSP430InstrInfo::analyzeBranch(), llvm::NVPTXInstrInfo::analyzeBranch(), llvm::PPCInstrInfo::analyzeBranch(), llvm::RISCVInstrInfo::analyzeBranch(), llvm::SystemZInstrInfo::analyzeBranch(), llvm::X86InstrInfo::analyzeBranch(), llvm::XCoreInstrInfo::analyzeBranch(), llvm::AArch64InstrInfo::analyzeBranch(), llvm::SIInstrInfo::analyzeBranch(), llvm::ARMBaseInstrInfo::analyzeBranch(), llvm::AVRInstrInfo::analyzeBranch(), llvm::CSKYInstrInfo::analyzeBranch(), llvm::SparcInstrInfo::analyzeBranch(), llvm::SPIRVInstrInfo::analyzeBranch(), llvm::VEInstrInfo::analyzeBranch(), llvm::WebAssemblyInstrInfo::analyzeBranch(), llvm::M68kInstrInfo::AnalyzeBranchImpl(), llvm::SIInstrInfo::analyzeBranchImpl(), llvm::X86InstrInfo::analyzeBranchPredicate(), llvm::analyzeICmp(), llvm::ARMBaseInstrInfo::analyzeSelect(), llvm::LanaiInstrInfo::analyzeSelect(), llvm::RISCVInstrInfo::analyzeSelect(), llvm::ScalarEvolution::applyLoopGuards(), llvm::ARMTargetLowering::ARMTargetLowering(), llvm::CanonicalLoopInfo::assertOK(), buildNonAtomicBinOp(), buildPartialInvariantUnswitchConditionalBranch(), buildPartialUnswitchConditionalBranch(), llvm::calculateUpperBound(), llvm::AArch64InstrInfo::canInsertSelect(), llvm::PPCInstrInfo::canInsertSelect(), llvm::X86InstrInfo::canInsertSelect(), llvm::SIInstrInfo::canInsertSelect(), CanProveNotTakenFirstIteration(), llvm::MachineBasicBlock::canSplitCriticalEdge(), llvm::canSplitLoopBound(), carryFlagToValue(), checkBoolTestAndOrSetCCCombine(), checkDecodedInstruction(), collectUnswitchCandidates(), combineBrCond(), combineCMov(), combineM68kBrCond(), combineOr(), llvm::VETargetLowering::combineSelect(), combineSelect(), combineSelectOfTwoConstants(), combineSubABS(), combineVSelectToBLENDV(), combineVSelectWithAllOnesOrZeros(), commuteSelect(), llvm::JumpThreadingPass::computeValueKnownInPredecessorsImpl(), ConditionalExpr::ConditionalExpr(), llvm::ConstantFoldSelectInstruction(), llvm::ConstantFoldTerminator(), ConvertSelectToConcatVector(), llvm::BranchInst::Create(), CreateAssert(), CreateAssertNot(), llvm::IRBuilderBase::CreateAssumption(), createCMovFP(), llvm::IRBuilderBase::CreateCondBr(), llvm::PeelingModuloScheduleExpander::CreateLCSSAExitingBlock(), llvm::OpenMPIRBuilder::createLoopSkeleton(), createNodeForSelectViaUMinSeq(), llvm::OpenMPIRBuilder::createParallel(), llvm::VPBuilder::createSelect(), createShuffleMaskFromVSELECT(), llvm::parallel::detail::Latch::dec(), DecodeLDR(), dependsOnLocalPhi(), distributeOpThroughSelect(), eliminateDeadSwitchCases(), llvm::SelectionDAGBuilder::EmitBranchForMergedCondition(), llvm::PPCTargetLowering::EmitInstrWithCustomInserter(), EraseTerminatorAndDCECond(), llvm::VPWidenSelectRecipe::execute(), llvm::VPBlendRecipe::execute(), llvm::VPReductionRecipe::execute(), llvm::TargetLowering::expandIntMINMAX(), llvm::TargetLowering::expandShiftParts(), llvm::TargetLowering::expandShlSat(), findBestNonTrivialUnswitchCandidate(), FindLoopCounter(), llvm::SelectionDAGBuilder::FindMergedConditions(), FindWidenableTerminatorAboveLoop(), FixTail(), llvm::PeelingModuloScheduleExpander::fixupBranches(), llvm::CondOpInit::Fold(), foldADCToCINC(), foldBitCastSelect(), foldBoolSelectToLogic(), llvm::FoldBranchToCommonDest(), FoldCondBranchOnValueKnownInPredecessorImpl(), foldCSELOfCSEL(), llvm::AMDGPUTargetLowering::foldFreeOpFromSelect(), llvm::InstCombinerImpl::foldGEPICmp(), llvm::InstCombinerImpl::foldICmpSelectConstant(), foldMulSelectToNegate(), foldSelectGEP(), foldSelectOfConstantsUsingSra(), llvm::InstCombinerImpl::foldSelectOpOp(), foldSelectWithBinaryOp(), foldSelectWithIdentityConstant(), llvm::SelectionDAG::FoldSetCC(), foldSetCCWithFunnelShift(), foldSetCCWithRotate(), foldSetClearBits(), llvm::InstCombinerImpl::FoldShiftByConstant(), foldXorTruncShiftIntoCmp(), for(), generateReproducer(), getBBFallenThrough(), getBitTestCondition(), llvm::CanonicalLoopInfo::getBody(), getBranchCondString(), getCmp(), llvm::CanonicalLoopInfo::getCond(), llvm::SelectionDAG::getCondCode(), getCondCode(), llvm::MachineBasicBlock::getFallThrough(), getFauxShuffleMask(), getHashValueImpl(), getIntrinsicCmp(), llvm::HexagonInstrInfo::getInvertedPredSense(), getOnlyLiveSuccessor(), llvm::AMDGPU::getOprIdx(), llvm::HexagonInstrInfo::getPredReg(), getPTest(), llvm::SelectionDAG::getSelect(), llvm::SelectionDAG::getSelectCC(), llvm::SelectionDAG::getSetCC(), getSETCC(), llvm::SelectionDAG::getSetCCVP(), llvm::CanonicalLoopInfo::getTripCount(), llvm::MipsTargetLowering::getTypeForExtReturn(), llvm::ISD::getUnorderedFlavor(), getValueFromCondition(), getValueFromConditionImpl(), getValueOnFirstIteration(), getX86XALUOOp(), handleOtherCmpSelSimplifications(), hasOnlySelectUsers(), llvm::hasProcessableCondition(), llvm::ARCInstrInfo::insertBranch(), llvm::AArch64InstrInfo::insertBranch(), llvm::R600InstrInfo::insertBranch(), llvm::SIInstrInfo::insertBranch(), llvm::ARMBaseInstrInfo::insertBranch(), llvm::AVRInstrInfo::insertBranch(), llvm::BPFInstrInfo::insertBranch(), llvm::CSKYInstrInfo::insertBranch(), llvm::HexagonInstrInfo::insertBranch(), llvm::LoongArchInstrInfo::insertBranch(), llvm::M68kInstrInfo::insertBranch(), llvm::MipsInstrInfo::insertBranch(), llvm::MSP430InstrInfo::insertBranch(), llvm::NVPTXInstrInfo::insertBranch(), llvm::PPCInstrInfo::insertBranch(), llvm::RISCVInstrInfo::insertBranch(), llvm::SparcInstrInfo::insertBranch(), llvm::SystemZInstrInfo::insertBranch(), llvm::VEInstrInfo::insertBranch(), llvm::WebAssemblyInstrInfo::insertBranch(), llvm::X86InstrInfo::insertBranch(), llvm::XCoreInstrInfo::insertBranch(), llvm::SIInstrInfo::insertSelect(), llvm::AArch64InstrInfo::insertSelect(), llvm::PPCInstrInfo::insertSelect(), llvm::X86InstrInfo::insertSelect(), llvm::SIInstrInfo::insertVectorSelect(), llvm::CanonicalLoopInfo::invalidate(), llvm::isAlmostDeadIV(), isAnalyzableBB(), isGuaranteedNotToBeUndefOrPoison(), llvm::isImpliedByDomCondition(), isLoopNeverExecuted(), llvm::ISD::isTrueWhenEqual(), IsVPNOTEquivalent(), jumpTableHasOtherUses(), llvm::SPIRVLegalizerInfo::legalizeCustom(), llvm::AMDGPULegalizerInfo::legalizeFrint(), llvm::AMDGPULegalizerInfo::legalizeUnsignedDIV_REM32Impl(), LLVMSetCondition(), llvm::X86TargetLowering::LowerAsmOutputForConstraint(), llvm::LanaiTargetLowering::LowerBR_CC(), LowerBRCOND(), LowerBUILD_VECTORvXi1(), llvm::AMDGPUTargetLowering::LowerFRINT(), llvm::RISCVTargetLowering::LowerOperation(), llvm::LanaiTargetLowering::LowerSELECT_CC(), llvm::LanaiTargetLowering::LowerSETCC(), LowerSETCCCARRY(), llvm::AMDGPUTargetLowering::LowerUDIVREM(), lowerVSELECTtoVectorShuffle(), LowerVSETCC(), LowerVSETCCWithSUBUS(), LowerXALUO(), ConditionalExpr::match(), llvm::PatternMatch::LogicalOp_match< LHS, RHS, Opcode, Commutable >::match(), matchCondition(), AMDGPUPostLegalizerCombinerHelper::matchFMinFMaxLegacy(), llvm::CombinerHelper::matchSelectToLogical(), matchSelectWithOptionalNotCond(), llvm::CombinerHelper::matchSimplifySelectToMinMax(), llvm::JumpThreadingPass::maybethreadThroughTwoBasicBlocks(), llvm::MSP430TargetLowering::MSP430TargetLowering(), llvm::InsertCFGStrategy::mutate(), narrowVectorSelect(), needsLFTR(), parseCC(), parseCond(), parseCondBranch(), parseConstraintCode(), AbstractManglingParser< Derived, Alloc >::parseExpr(), llvm::parseWidenableBranch(), llvm::PeelSingleBlockLoop(), llvm::ARMTargetLowering::PerformCMOVCombine(), PerformCMPZCombine(), PerformCSETCombine(), llvm::AMDGPUTargetLowering::performCtlz_CttzCombine(), llvm::HexagonTargetLowering::PerformDAGCombine(), PerformHWLoopCombine(), performORCombine(), performOrXorChainCombine(), llvm::AMDGPUTargetLowering::performSelectCombine(), performSETCCCombine(), performSetccMergeZeroCombine(), performSetCCPunpkCombine(), PerformVCMPCombine(), PerformVSELECTCombine(), llvm::HexagonInstrInfo::PredicateInstruction(), llvm::HexagonInstrInfo::predOpcodeHasNot(), prepareICWorklistFromFunction(), ConditionalExpr::printLeft(), llvm::JumpThreadingPass::processImpliedCondition(), processSwitch(), llvm::JumpThreadingPass::processThreadableEdges(), recordCondition(), removeUndefIntroducingPredecessor(), replaceFoldableUses(), llvm::AArch64InstrInfo::reverseBranchCondition(), llvm::R600InstrInfo::reverseBranchCondition(), llvm::SIInstrInfo::reverseBranchCondition(), llvm::ARCInstrInfo::reverseBranchCondition(), llvm::ARMBaseInstrInfo::reverseBranchCondition(), llvm::AVRInstrInfo::reverseBranchCondition(), llvm::CSKYInstrInfo::reverseBranchCondition(), llvm::HexagonInstrInfo::reverseBranchCondition(), llvm::LoongArchInstrInfo::reverseBranchCondition(), llvm::MipsInstrInfo::reverseBranchCondition(), llvm::MSP430InstrInfo::reverseBranchCondition(), llvm::PPCInstrInfo::reverseBranchCondition(), llvm::RISCVInstrInfo::reverseBranchCondition(), llvm::SparcInstrInfo::reverseBranchCondition(), llvm::SystemZInstrInfo::reverseBranchCondition(), llvm::VEInstrInfo::reverseBranchCondition(), llvm::WebAssemblyInstrInfo::reverseBranchCondition(), llvm::X86InstrInfo::reverseBranchCondition(), llvm::XCoreInstrInfo::reverseBranchCondition(), llvm::RewriteStatepointsForGC::runOnFunction(), shouldConvertSelectOfConstantsToMath(), shouldInsertFreeze(), simplifyCmpSelCase(), simplifyCmpSelFalseCase(), simplifyCmpSelTrueCase(), SimplifyCondBranchToCondBranch(), simplifyOneLoop(), llvm::SelectionDAG::simplifySelect(), llvm::simplifySelectInst(), simplifySelectInst(), llvm::InstCombinerImpl::SimplifySelectsFeedingBinaryOp(), simplifySelectWithFCmp(), llvm::TargetLowering::SimplifySetCC(), simplifySetCCWithCTPOP(), simplifyTerminatorLeadingToRet(), simplifyUsingControlFlow(), skipTrivialSelect(), llvm::SplitBlockAndInsertIfThen(), llvm::SplitBlockAndInsertIfThenElse(), llvm::MachineBasicBlock::SplitCriticalEdge(), splitEdge(), splitIntVSETCC(), llvm::splitLoopBound(), STATISTIC(), llvm::parallel::detail::Latch::sync(), threadCmpOverSelect(), transformToIndexedCompare(), tryDemorganOfBooleanCondition(), trySwitchToSelect(), llvm::JumpThreadingPass::tryToUnfoldSelectInCurrBB(), unswitchNontrivialInvariants(), unswitchTrivialBranch(), llvm::MachineBasicBlock::updateTerminator(), llvm::HexagonInstrInfo::validateBranchCond(), llvm::GenericCycleInfo< ContextT >::validateTree(), llvm::versionCallSite(), llvm::InstCombinerImpl::visitBranchInst(), llvm::Interpreter::visitBranchInst(), llvm::InstCombinerImpl::visitCallInst(), llvm::InstCombinerImpl::visitFNeg(), llvm::InstCombinerImpl::visitFPTrunc(), llvm::InstCombinerImpl::visitICmpInst(), llvm::InstCombinerImpl::visitSDiv(), llvm::InstCombinerImpl::visitSub(), llvm::SelectionDAGBuilder::visitSwitchCase(), llvm::Interpreter::visitSwitchInst(), llvm::InstCombinerImpl::visitSwitchInst(), and llvm::wouldInstructionBeTriviallyDead().

◆ PreLayoutFallThroughs

const SmallVector<MachineBasicBlock *>& PreLayoutFallThroughs
Initial value:
{
const TargetInstrInfo *TII = MF.getSubtarget().getInstrInfo()
const HexagonInstrInfo * TII
TargetInstrInfo - Interface to description of machine instruction set.

Definition at line 135 of file BasicBlockSections.cpp.

Referenced by for(), and llvm::sortBasicBlocksAndUpdateBranches().