|
LLVM 23.0.0git
|
#include "llvm/Transforms/Scalar/MergeICmps.h"#include "llvm/ADT/SmallString.h"#include "llvm/Analysis/AliasAnalysis.h"#include "llvm/Analysis/DomTreeUpdater.h"#include "llvm/Analysis/Loads.h"#include "llvm/Analysis/TargetLibraryInfo.h"#include "llvm/Analysis/TargetTransformInfo.h"#include "llvm/IR/Dominators.h"#include "llvm/IR/Function.h"#include "llvm/IR/IRBuilder.h"#include "llvm/IR/Instruction.h"#include "llvm/IR/ProfDataUtils.h"#include "llvm/Transforms/Utils/BasicBlockUtils.h"#include "llvm/Transforms/Utils/BuildLibCalls.h"#include <algorithm>#include <numeric>#include <utility>#include <vector>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) |
| #define DEBUG_TYPE "mergeicmps" |
Definition at line 65 of file MergeICmps.cpp.
|
static |
Determine the branch weights for the resulting conditional branch, resulting after merging Comparisons.
Definition at line 612 of file MergeICmps.cpp.
References assert(), llvm::CallingConv::C, llvm::ArrayRef< T >::empty(), llvm::extractBranchWeights(), llvm::fitWeights(), llvm::getDisjunctionWeights(), llvm::ProfcheckDisableMetadataFixes, llvm::ArrayRef< T >::size(), and std::swap().
Referenced by mergeComparisons().
|
inlinestatic |
Definition at line 388 of file MergeICmps.cpp.
References llvm::dbgs(), and LLVM_DEBUG.
|
static |
Definition at line 783 of file MergeICmps.cpp.
References assert(), llvm::dbgs(), llvm::BasicBlock::getSinglePredecessor(), llvm::BasicBlock::hasAddressTaken(), and LLVM_DEBUG.
Referenced by processPhi().
|
static |
Given a chain of comparison blocks, groups the blocks into contiguous ranges that can be merged together into a single comparison.
Definition at line 444 of file MergeICmps.cpp.
References areContiguous(), llvm::Block, llvm::dbgs(), getMinOrigOrder(), LLVM_DEBUG, and llvm::sort().
|
static |
Definition at line 641 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().
|
static |
Definition at line 816 of file MergeICmps.cpp.
References llvm::cast(), llvm::dbgs(), getOrderedBlocks(), llvm::BasicBlock::getSingleSuccessor(), I, llvm::isa(), and LLVM_DEBUG.
Referenced by runImpl().
|
static |
Definition at line 885 of file MergeICmps.cpp.
References llvm::dbgs(), llvm::drop_begin(), llvm::dyn_cast(), F, llvm::TargetLibraryInfo::has(), LLVM_DEBUG, and processPhi().
|
static |
Definition at line 340 of file MergeICmps.cpp.
References assert(), llvm::Block, llvm::cast(), Cond, llvm::dbgs(), llvm::dyn_cast(), llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::isa(), LLVM_DEBUG, and visitICmp().
|
static |
Definition at line 310 of file MergeICmps.cpp.
References llvm::dbgs(), DL, llvm::Instruction::getDataLayout(), llvm::User::getOperand(), llvm::CmpInst::getPredicate(), llvm::Value::getType(), llvm::Value::hasOneUse(), llvm::CmpInst::ICMP_EQ, LLVM_DEBUG, and visitICmpLoadOperand().
Referenced by visitCmpBlock().
Definition at line 137 of file MergeICmps.cpp.
References llvm::sampleprof::Base, llvm::dbgs(), DL, llvm::dyn_cast(), GEP, llvm::Type::getPointerAddressSpace(), llvm::Value::getType(), llvm::isDereferenceablePointer(), LLVM_DEBUG, and llvm::Offset.
Referenced by visitICmp().