|
LLVM 22.0.0git
|
#include "llvm/Transforms/Scalar/MergeICmps.h"#include "llvm/ADT/SmallString.h"#include "llvm/Analysis/DomTreeUpdater.h"#include "llvm/Analysis/GlobalsModRef.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/Instruction.h"#include "llvm/IR/IRBuilder.h"#include "llvm/InitializePasses.h"#include "llvm/Pass.h"#include "llvm/Transforms/Scalar.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.
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 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 |
| #define DEBUG_TYPE "mergeicmps" |
Definition at line 67 of file MergeICmps.cpp.
|
inlinestatic |
Definition at line 389 of file MergeICmps.cpp.
References llvm::dbgs(), and LLVM_DEBUG.
|
static |
Definition at line 750 of file MergeICmps.cpp.
References assert(), llvm::dbgs(), llvm::BasicBlock::getSinglePredecessor(), llvm::BasicBlock::hasAddressTaken(), and LLVM_DEBUG.
Referenced by processPhi().
| INITIALIZE_PASS_BEGIN | ( | MergeICmpsLegacyPass | , |
| "mergeicmps" | , | ||
| "Merge contiguous icmps into a memcmp" | , | ||
| false | , | ||
| false | ) |
References INITIALIZE_PASS_DEPENDENCY.
|
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 445 of file MergeICmps.cpp.
References areContiguous(), llvm::Block, llvm::dbgs(), getMinOrigOrder(), LLVM_DEBUG, and llvm::sort().
|
static |
Definition at line 611 of file MergeICmps.cpp.
References llvm::GenericDomTreeUpdater< DerivedT, DomTreeT, PostDomTreeT >::applyUpdates(), assert(), B(), llvm::ArrayRef< T >::begin(), llvm::CallingConv::C, 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(), Size, and llvm::ArrayRef< T >::size().
|
static |
Definition at line 783 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 852 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 339 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_DEBUG, and visitICmp().
|
static |
Definition at line 309 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 136 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().
| Merge contiguous icmps into a false |
Definition at line 919 of file MergeICmps.cpp.
| Merge contiguous icmps into a memcmp |
Definition at line 919 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().
| mergeicmps |
Definition at line 918 of file MergeICmps.cpp.