LLVM 22.0.0git
|
#include "llvm/Analysis/BasicAliasAnalysis.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/CFG.h"
#include "llvm/Analysis/CaptureTracking.h"
#include "llvm/Analysis/MemoryBuiltins.h"
#include "llvm/Analysis/MemoryLocation.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/ConstantRange.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GetElementPtrTypeIterator.h"
#include "llvm/IR/GlobalAlias.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/User.h"
#include "llvm/IR/Value.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/KnownBits.h"
#include "llvm/Support/SaveAndRestore.h"
#include <cassert>
#include <cstdint>
#include <cstdlib>
#include <optional>
#include <utility>
Go to the source code of this file.
Classes | |
struct | llvm::BasicAAResult::DecomposedGEP |
Macros | |
#define | DEBUG_TYPE "basicaa" |
Functions | |
STATISTIC (SearchLimitReached, "Number of times the limit to " "decompose GEPs is reached") | |
SearchLimitReached / SearchTimes shows how often the limit of to decompose GEPs is reached. | |
STATISTIC (SearchTimes, "Number of times a GEP is decomposed") | |
static std::optional< TypeSize > | getObjectSize (const Value *V, const DataLayout &DL, const TargetLibraryInfo &TLI, bool NullIsValidLoc, bool RoundToAlign=false) |
Returns the size of the object specified by V or UnknownSize if unknown. | |
static bool | isObjectSmallerThan (const Value *V, TypeSize Size, const DataLayout &DL, const TargetLibraryInfo &TLI, bool NullIsValidLoc) |
Returns true if we can prove that the object specified by V is smaller than Size. | |
static TypeSize | getMinimalExtentFrom (const Value &V, const LocationSize &LocSize, const DataLayout &DL, bool NullIsValidLoc) |
Return the minimal extent from V to the end of the underlying object, assuming the result is used in an aliasing query. | |
static bool | isObjectSize (const Value *V, TypeSize Size, const DataLayout &DL, const TargetLibraryInfo &TLI, bool NullIsValidLoc) |
Returns true if we can prove that the object specified by V has size Size. | |
static bool | areBothVScale (const Value *V1, const Value *V2) |
Return true if both V1 and V2 are VScale. | |
static bool | isNotInCycle (const Instruction *I, const DominatorTree *DT, const LoopInfo *LI) |
static LinearExpression | GetLinearExpression (const CastedValue &Val, const DataLayout &DL, unsigned Depth, AssumptionCache *AC, DominatorTree *DT) |
Analyzes the specified value as a linear expression: "A*V + B", where A and B are constant integers. | |
static bool | isIntrinsicCall (const CallBase *Call, Intrinsic::ID IID) |
static const Function * | getParent (const Value *V) |
static bool | notDifferentParent (const Value *O1, const Value *O2) |
static AliasResult | MergeAliasResults (AliasResult A, AliasResult B) |
static bool | isArgumentOrArgumentLike (const Value *V) |
INITIALIZE_PASS_BEGIN (BasicAAWrapperPass, "basic-aa", "Basic Alias Analysis (stateless AA impl)", true, true) INITIALIZE_PASS_END(BasicAAWrapperPass | |
basic Basic Alias | Analysis (stateless AA impl)" |
Variables | |
static cl::opt< bool > | EnableRecPhiAnalysis ("basic-aa-recphi", cl::Hidden, cl::init(true)) |
Enable analysis of recursive PHI nodes. | |
static cl::opt< bool > | EnableSeparateStorageAnalysis ("basic-aa-separate-storage", cl::Hidden, cl::init(true)) |
basic | aa |
basic Basic Alias | true |
#define DEBUG_TYPE "basicaa" |
Definition at line 64 of file BasicAliasAnalysis.cpp.
basic Basic Alias Analysis | ( | stateless AA | impl | ) |
Return true if both V1 and V2 are VScale.
Definition at line 187 of file BasicAliasAnalysis.cpp.
References llvm::PatternMatch::m_VScale(), and llvm::PatternMatch::match().
|
static |
Analyzes the specified value as a linear expression: "A*V + B", where A and B are constant integers.
Definition at line 419 of file BasicAliasAnalysis.cpp.
References llvm::cast(), llvm::Depth, DL, llvm::dyn_cast(), E(), GetLinearExpression(), llvm::isa(), and RHS.
Referenced by GetLinearExpression().
|
static |
Return the minimal extent from V
to the end of the underlying object, assuming the result is used in an aliasing query.
E.g., we do use the query location size and the fact that null pointers cannot alias here.
Definition at line 159 of file BasicAliasAnalysis.cpp.
References DL, llvm::TypeSize::getFixed(), llvm::details::FixedOrScalableQuantity< LeafTy, ValueTy >::getKnownMinValue(), llvm::LocationSize::getValue(), and llvm::LocationSize::isPrecise().
|
static |
Returns the size of the object specified by V or UnknownSize if unknown.
Definition at line 101 of file BasicAliasAnalysis.cpp.
References DL, llvm::getBaseObjectSize(), llvm::ObjectSizeOpts::NullIsUnknownSize, llvm::ObjectSizeOpts::RoundToAlign, and Size.
Definition at line 885 of file BasicAliasAnalysis.cpp.
References llvm::dyn_cast(), and llvm::GlobalValue::getParent().
Referenced by llvm::slpvectorizer::BoUpSLP::canVectorizeLoads(), llvm::CFIInstBuilder::CFIInstBuilder(), llvm::CloneAndPruneIntoFromInst(), llvm::LoopVectorizationCostModel::collectValuesToIgnore(), llvm::JumpThreadingPass::computeValueKnownInPredecessorsImpl(), llvm::DataDependenceGraph::DataDependenceGraph(), detectPopcountIdiom(), llvm::DiagnosticInfoMIROptimization::DiagnosticInfoMIROptimization(), llvm::DiagnosticInfoMisExpect::DiagnosticInfoMisExpect(), llvm::DiagnosticInfoOptimizationFailure::DiagnosticInfoOptimizationFailure(), ensureValueAvailableInSuccessor(), llvm::InstCombinerImpl::foldOpIntoPhi(), foldURemOfLoopIncrement(), llvm::FunctionPropertiesUpdater::FunctionPropertiesUpdater(), llvm::RegionBase< Tr >::getDepth(), getLocalFunctionMetadata(), llvm::LoopBase< BasicBlock, Loop >::getLoopLatch(), llvm::TargetLoweringObjectFileGOFF::getModuleMetadata(), llvm::LazyValueInfo::getPredicateAt(), llvm::slpvectorizer::BoUpSLP::getReorderingData(), llvm::MCSectionGOFF::getTextStyle(), llvm::InlineAdvice::InlineAdvice(), ARMInstructionSelector::InsertInfo::InsertInfo(), llvm::InstrEmitter::InstrEmitter(), isBlockValidForExtraction(), llvm::VPWidenIntOrFpInductionRecipe::isCanonical(), llvm::PHINode::isComplete(), isOnlyUsedInEntryBlock(), isUsedOutsideOfDefiningBlock(), LLVMGetBasicBlockParent(), LLVMGetGlobalParent(), LLVMGetInstructionParent(), LLVMGetParamParent(), llvm::LoopConstrainer::LoopConstrainer(), llvm::MachineIRBuilder::MachineIRBuilder(), llvm::MachineModuleSlotTracker::MachineModuleSlotTracker(), llvm::MachineOptimizationRemarkAnalysis::MachineOptimizationRemarkAnalysis(), llvm::VPlanTransforms::materializeBroadcasts(), llvm::MIBundleBuilder::MIBundleBuilder(), notDifferentParent(), llvm::OptimizationRemark::OptimizationRemark(), llvm::OptimizationRemark::OptimizationRemark(), llvm::OptimizationRemarkAnalysis::OptimizationRemarkAnalysis(), llvm::OptimizationRemarkAnalysis::OptimizationRemarkAnalysis(), llvm::OptimizationRemarkAnalysis::OptimizationRemarkAnalysis(), llvm::OptimizationRemarkMissed::OptimizationRemarkMissed(), llvm::OptimizationRemarkMissed::OptimizationRemarkMissed(), llvm::BasicBlock::print(), llvm::DbgMarker::print(), llvm::Function::print(), llvm::MachineFunction::print(), llvm::NamedMDNode::print(), llvm::NamedMDNode::print(), llvm::PrologEpilogSGPRSpillBuilder::PrologEpilogSGPRSpillBuilder(), redirectValuesFromPredecessorsToPhi(), llvm::AssumptionCache::registerAssumption(), llvm::VerifyInstrumentation::registerCallbacks(), RemarkInfo::RemarkInfo(), llvm::LoopRotatePass::run(), llvm::ScheduleDAGMI::schedule(), llvm::ScheduleDAGMILive::schedule(), llvm::SIScheduleDAGMI::schedule(), llvm::VLIWMachineScheduler::schedule(), llvm::SGPRSpillBuilder::SGPRSpillBuilder(), llvm::SlotTracker::SlotTracker(), splitCallSite(), llvm::GenericCycle< ContextT >::verifyCycle(), and llvm::slpvectorizer::BoUpSLP::VLOperands::VLOperands().
INITIALIZE_PASS_BEGIN | ( | BasicAAWrapperPass | , |
"basic-aa" | , | ||
"Basic Alias Analysis (stateless AA impl)" | , | ||
true | , | ||
true | ) |
References INITIALIZE_PASS_DEPENDENCY.
Definition at line 1579 of file BasicAliasAnalysis.cpp.
References llvm::dyn_cast(), E(), and llvm::isa().
|
static |
Definition at line 827 of file BasicAliasAnalysis.cpp.
References Call, llvm::dyn_cast(), and II.
Referenced by llvm::BasicAAResult::getModRefInfo(), llvm::BasicAAResult::getModRefInfo(), isPreserveArrayIndex(), isPreserveStructIndex(), and isPreserveUnionIndex().
|
static |
Definition at line 216 of file BasicAliasAnalysis.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::empty(), I, llvm::isPotentiallyReachableFromMany(), and llvm::successors().
Referenced by llvm::EarliestEscapeAnalysis::getCapturesBefore().
|
static |
Returns true if we can prove that the object specified by V has size Size.
Definition at line 179 of file BasicAliasAnalysis.cpp.
References DL, llvm::getObjectSize(), and Size.
|
static |
Returns true if we can prove that the object specified by V is smaller than Size.
Bails out early unless the root object is passed as the first parameter.
Definition at line 121 of file BasicAliasAnalysis.cpp.
References DL, llvm::getObjectSize(), llvm::isIdentifiedObject(), llvm::details::FixedOrScalableQuantity< TypeSize, uint64_t >::isKnownLT(), and Size.
|
static |
Definition at line 1410 of file BasicAliasAnalysis.cpp.
References A(), B(), llvm::AliasResult::MayAlias, llvm::AliasResult::MustAlias, and llvm::AliasResult::PartialAlias.
Definition at line 898 of file BasicAliasAnalysis.cpp.
References getParent().
Referenced by llvm::BasicAAResult::alias(), and llvm::BasicAAResult::getModRefInfo().
STATISTIC | ( | SearchLimitReached | , |
"Number of times the limit to " "decompose GEPs is reached" | ) |
SearchLimitReached / SearchTimes shows how often the limit of to decompose GEPs is reached.
It will affect the precision of basic alias analysis.
STATISTIC | ( | SearchTimes | , |
"Number of times a GEP is decomposed" | ) |
basic aa |
Definition at line 2035 of file BasicAliasAnalysis.cpp.
|
static |
Enable analysis of recursive PHI nodes.
|
static |