LLVM: lib/Transforms/Scalar/MergeICmps.cpp File Reference (original) (raw)

Go to the source code of this file.

Namespaces
namespace llvm
This is an optimization pass for GlobalISel generic memory operations.
Macros
#define DEBUG_TYPE "mergeicmps"
Functions
static BCEAtom visitICmpLoadOperand (Value *const Val, BaseIdentifier &BaseId)
static std::optional< BCECmp > visitICmp (const ICmpInst *const CmpI, const ICmpInst::Predicate ExpectedPredicate, BaseIdentifier &BaseId)
static std::optional< BCECmpBlock > visitCmpBlock (Value *const Val, BasicBlock *const Block, const BasicBlock *const PhiBlock, BaseIdentifier &BaseId)
static void enqueueBlock (std::vector< BCECmpBlock > &Comparisons, BCECmpBlock &&Comparison)
static bool areContiguous (const BCECmpBlock &First, const BCECmpBlock &Second)
static unsigned getMinOrigOrder (const BCECmpChain::ContiguousBlocks &Blocks)
static std::vector< BCECmpChain::ContiguousBlocks > mergeBlocks (std::vector< BCECmpBlock > &&Blocks)
Given a chain of comparison blocks, groups the blocks into contiguous ranges that can be merged together into a single comparison.
static std::optional< SmallVector< uint32_t, 2 > > computeMergedBranchWeights (ArrayRef< BCECmpBlock > Comparisons)
Determine the branch weights for the resulting conditional branch, resulting after merging Comparisons.
static BasicBlock * mergeComparisons (ArrayRef< BCECmpBlock > Comparisons, BasicBlock *const InsertBefore, BasicBlock *const NextCmpBlock, PHINode &Phi, const TargetLibraryInfo &TLI, AliasAnalysis &AA, DomTreeUpdater &DTU)
static std::vector< BasicBlock * > getOrderedBlocks (PHINode &Phi, BasicBlock *const LastBlock, int NumBlocks)
static bool processPhi (PHINode &Phi, const TargetLibraryInfo &TLI, AliasAnalysis &AA, DomTreeUpdater &DTU)
static bool runImpl (Function &F, const TargetLibraryInfo &TLI, const TargetTransformInfo &TTI, AliasAnalysis &AA, DominatorTree *DT)
INITIALIZE_PASS_BEGIN (MergeICmpsLegacyPass, "mergeicmps", "Merge contiguous icmps into a memcmp", false, false) INITIALIZE_PASS_END(MergeICmpsLegacyPass
Variables
mergeicmps
Merge contiguous icmps into a memcmp
Merge contiguous icmps into a false

DEBUG_TYPE

#define DEBUG_TYPE "mergeicmps"

areContiguous()

bool areContiguous ( const BCECmpBlock & First, const BCECmpBlock & Second ) static

computeMergedBranchWeights()

enqueueBlock()

void enqueueBlock ( std::vector< BCECmpBlock > & Comparisons, BCECmpBlock && Comparison ) inlinestatic

getMinOrigOrder()

unsigned getMinOrigOrder ( const BCECmpChain::ContiguousBlocks & Blocks) static

getOrderedBlocks()

INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( MergeICmpsLegacyPass ,
"mergeicmps" ,
"Merge contiguous icmps into a memcmp" ,
false ,
false )

mergeBlocks()

std::vector< BCECmpChain::ContiguousBlocks > mergeBlocks ( std::vector< BCECmpBlock > && Blocks) static

mergeComparisons()

Definition at line 646 of file MergeICmps.cpp.

References llvm::GenericDomTreeUpdater< DerivedT, DomTreeT, PostDomTreeT >::applyUpdates(), assert(), B(), llvm::ArrayRef< T >::begin(), llvm::CallingConv::C, computeMergedBranchWeights(), llvm::BasicBlock::Create(), llvm::dbgs(), DL, llvm::emitMemCmp(), llvm::ArrayRef< T >::empty(), llvm::ArrayRef< T >::end(), llvm::find_if(), llvm::BasicBlock::getContext(), llvm::ConstantInt::getFalse(), llvm::TargetLibraryInfo::getIntSize(), llvm::Value::getName(), llvm::User::getOperand(), llvm::BasicBlock::getParent(), llvm::TargetLibraryInfo::getSizeTSize(), llvm::DominatorTreeBase< BasicBlock, false >::Insert, LLVM_DEBUG, llvm::User::replaceUsesOfWith(), llvm::setBranchWeights(), Size, and llvm::ArrayRef< T >::size().

processPhi()

runImpl()

visitCmpBlock()

visitICmp()

std::optional< BCECmp > visitICmp ( const ICmpInst *const CmpI, const ICmpInst::Predicate ExpectedPredicate, BaseIdentifier & BaseId ) static

visitICmpLoadOperand()

BCEAtom visitICmpLoadOperand ( Value *const Val, BaseIdentifier & BaseId ) static

false

Merge contiguous icmps into a false

memcmp

Merge contiguous icmps into a memcmp

Definition at line 957 of file MergeICmps.cpp.

Referenced by areFilesDifferent(), llvm::ELF::Elf32_Ehdr::checkMagic(), llvm::ELF::Elf64_Ehdr::checkMagic(), llvm::object::Elf_Ehdr_Impl< ELFType< E, Is64 > >::checkMagic(), llvm::jitlink::createLinkGraphFromCOFFObject(), llvm::jitlink::createLinkGraphFromELFObject(), FindSequence(), gsiRecordCmp(), llvm::identify_magic(), llvm::dxbc::ShaderHash::isPopulated(), llvm::FoldingSetNodeIDRef::operator<(), llvm::codeview::operator==(), llvm::FoldingSetNodeIDRef::operator==(), llvm::gsym::operator==(), llvm::minidump::operator==(), and llvm::ifs::writeELFBinaryToFile().