|
LLVM
4.0.0
|
#include "llvm/Analysis/BasicAliasAnalysis.h"#include "llvm/ADT/SmallVector.h"#include "llvm/ADT/Statistic.h"#include "llvm/Analysis/AliasAnalysis.h"#include "llvm/Analysis/CFG.h"#include "llvm/Analysis/CaptureTracking.h"#include "llvm/Analysis/InstructionSimplify.h"#include "llvm/Analysis/LoopInfo.h"#include "llvm/Analysis/MemoryBuiltins.h"#include "llvm/Analysis/ValueTracking.h"#include "llvm/Analysis/AssumptionCache.h"#include "llvm/IR/Constants.h"#include "llvm/IR/DataLayout.h"#include "llvm/IR/DerivedTypes.h"#include "llvm/IR/Dominators.h"#include "llvm/IR/GlobalAlias.h"#include "llvm/IR/GlobalVariable.h"#include "llvm/IR/Instructions.h"#include "llvm/IR/IntrinsicInst.h"#include "llvm/IR/LLVMContext.h"#include "llvm/IR/Operator.h"#include "llvm/Pass.h"#include "llvm/Support/ErrorHandling.h"#include <algorithm>Go to the source code of this file.
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. More... | |
| STATISTIC (SearchTimes,"Number of times a GEP is decomposed") | |
| static bool | isNonEscapingLocalObject (const Value *V) |
| Returns true if the pointer is to a function-local object that never escapes from the function. More... | |
| static bool | isEscapeSource (const Value *V) |
| Returns true if the pointer is one which would have been considered an escape by isNonEscapingLocalObject. More... | |
| static uint64_t | getObjectSize (const Value *V, const DataLayout &DL, const TargetLibraryInfo &TLI, bool RoundToAlign=false) |
| Returns the size of the object specified by V or UnknownSize if unknown. More... | |
| static bool | isObjectSmallerThan (const Value *V, uint64_t Size, const DataLayout &DL, const TargetLibraryInfo &TLI) |
| Returns true if we can prove that the object specified by V is smaller than Size. More... | |
| static bool | isObjectSize (const Value *V, uint64_t Size, const DataLayout &DL, const TargetLibraryInfo &TLI) |
| Returns true if we can prove that the object specified by V has size Size. More... | |
| static int64_t | adjustToPointerSize (int64_t Offset, unsigned PointerSize) |
| To ensure a pointer offset fits in an integer of size PointerSize (in bits) when that size is smaller than 64. More... | |
| static bool | isWriteOnlyParam (ImmutableCallSite CS, unsigned ArgIdx, const TargetLibraryInfo &TLI) |
| Returns true if this is a writeonly (i.e Mod only) parameter. More... | |
| static bool | isIntrinsicCall (ImmutableCallSite CS, Intrinsic::ID IID) |
| static const Function * | getParent (const Value *V) |
| static bool | notDifferentParent (const Value *O1, const Value *O2) |
| static AliasResult | aliasSameBasePointerGEPs (const GEPOperator *GEP1, uint64_t V1Size, const GEPOperator *GEP2, uint64_t V2Size, const DataLayout &DL) |
| Provide ad-hoc rules to disambiguate accesses through two GEP operators, both having the exact same pointer operand. More... | |
| static AliasResult | MergeAliasResults (AliasResult A, AliasResult B) |
| INITIALIZE_PASS_BEGIN (BasicAAWrapperPass,"basicaa","Basic Alias Analysis (stateless AA impl)", true, true) INITIALIZE_PASS_END(BasicAAWrapperPass | |
| Basic Alias | Analysis (stateless AA impl)" |
Variables | |
| static cl::opt< bool > | EnableRecPhiAnalysis ("basicaa-recphi", cl::Hidden, cl::init(false)) |
| Enable analysis of recursive PHI nodes. More... | |
| const unsigned | MaxNumPhiBBsValueReachabilityCheck = 20 |
| Cutoff after which to stop analysing a set of phi nodes potentially involved in a cycle. More... | |
| static const unsigned | MaxLookupSearchDepth = 6 |
| basicaa | |
| Basic Alias | true |
| #define DEBUG_TYPE "basicaa" |
Definition at line 41 of file BasicAliasAnalysis.cpp.
|
static |
To ensure a pointer offset fits in an integer of size PointerSize (in bits) when that size is smaller than 64.
This is an issue in particular for 32b programs with negative indices that rely on two's complement wrap-arounds for precise alias information.
Definition at line 342 of file BasicAliasAnalysis.cpp.
References assert().
|
static |
Provide ad-hoc rules to disambiguate accesses through two GEP operators, both having the exact same pointer operand.
Definition at line 897 of file BasicAliasAnalysis.cpp.
References assert(), llvm::dyn_cast(), llvm::StructLayout::getElementOffset(), llvm::GetElementPtrInst::getIndexedType(), llvm::GEPOperator::getNumIndices(), llvm::User::getNumOperands(), llvm::User::getOperand(), llvm::GEPOperator::getPointerOperand(), llvm::ConstantInt::getSExtValue(), llvm::StructLayout::getSizeInBytes(), llvm::GEPOperator::getSourceElementType(), llvm::DataLayout::getStructLayout(), llvm::Value::getType(), llvm::DataLayout::getTypeStoreSize(), llvm::ConstantInt::getZExtValue(), i, llvm::isKnownNonEqual(), llvm::MayAlias, llvm::NoAlias, llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), llvm::Value::stripPointerCasts(), and llvm::MemoryLocation::UnknownSize.
| Basic Alias Analysis | ( | stateless AA | impl | ) |
|
static |
Returns the size of the object specified by V or UnknownSize if unknown.
Definition at line 126 of file BasicAliasAnalysis.cpp.
References llvm::getObjectSize(), and llvm::MemoryLocation::UnknownSize.
Definition at line 682 of file BasicAliasAnalysis.cpp.
References llvm::GlobalValue::getParent().
Referenced by llvm::FastISel::canFoldAddIntoGEP(), llvm::colorEHFunclets(), llvm::JumpThreadingPass::ComputeValueKnownInPredecessors(), ensureValueAvailableInSuccessor(), findBasePointers(), llvm::LiveVariables::VarInfo::findKill(), llvm::RegionBase< RegionTr >::getDepth(), getLocalFunction(), llvm::LazyValueInfo::getPredicateAt(), getReductionValue(), llvm::FastISel::hasTrivialKill(), LLVMGetBasicBlockParent(), LLVMGetGlobalParent(), LLVMGetInstructionParent(), LLVMGetParamParent(), llvm::NVPTXTargetLowering::LowerFormalArguments(), llvm::PHITransAddr::NeedsPHITranslationFromBlock(), notDifferentParent(), PlaceMarkers(), llvm::MachineFunction::print(), processSwitch(), redirectValuesFromPredecessorsToPhi(), llvm::AssumptionCache::registerAssumption(), llvm::slpvectorizer::BoUpSLP::vectorizeTree(), and llvm::LoopBase< N, M >::verifyLoop().
| INITIALIZE_PASS_BEGIN | ( | BasicAAWrapperPass | , |
| "basicaa" | , | ||
| "Basic Alias Analysis (stateless AA impl)" | , | ||
| true | , | ||
| true | |||
| ) |
Returns true if the pointer is one which would have been considered an escape by isNonEscapingLocalObject.
Definition at line 112 of file BasicAliasAnalysis.cpp.
|
static |
Definition at line 676 of file BasicAliasAnalysis.cpp.
References llvm::dyn_cast(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getInstruction(), and llvm::IntrinsicInst::getIntrinsicID().
Referenced by llvm::BasicAAResult::getModRefInfo().
Returns true if the pointer is to a function-local object that never escapes from the function.
Definition at line 87 of file BasicAliasAnalysis.cpp.
References A, llvm::isNoAliasCall(), and llvm::PointerMayBeCaptured().
Referenced by llvm::BasicAAResult::getModRefInfo().
|
static |
Returns true if we can prove that the object specified by V has size Size.
Definition at line 177 of file BasicAliasAnalysis.cpp.
References llvm::getObjectSize(), and llvm::MemoryLocation::UnknownSize.
|
static |
Returns true if we can prove that the object specified by V is smaller than Size.
Definition at line 137 of file BasicAliasAnalysis.cpp.
References llvm::getObjectSize(), llvm::isIdentifiedObject(), and llvm::MemoryLocation::UnknownSize.
|
static |
Returns true if this is a writeonly (i.e Mod only) parameter.
Definition at line 636 of file BasicAliasAnalysis.cpp.
References F, llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::getCalledFunction(), llvm::TargetLibraryInfo::getLibFunc(), llvm::TargetLibraryInfo::has(), llvm::CallSiteBase< FunTy, BBTy, ValTy, UserTy, UseTy, InstrTy, CallTy, InvokeTy, IterTy >::paramHasAttr(), and AMDGPU::RuntimeMD::KernelArg::WriteOnly.
Referenced by llvm::BasicAAResult::getArgModRefInfo().
|
static |
Definition at line 1315 of file BasicAliasAnalysis.cpp.
References A, llvm::MayAlias, llvm::MustAlias, and llvm::PartialAlias.
Definition at line 692 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" | |||
| ) |
| basicaa |
Definition at line 1781 of file BasicAliasAnalysis.cpp.
Enable analysis of recursive PHI nodes.
Definition at line 64 of file BasicAliasAnalysis.cpp.
Cutoff after which to stop analysing a set of phi nodes potentially involved in a cycle.
Because we are analysing 'through' phi nodes, we need to be careful with value equivalence. We use reachability to make sure a value cannot be involved in a cycle.
Definition at line 59 of file BasicAliasAnalysis.cpp.
1.8.6