75 if (
const Argument *
A = dyn_cast<Argument>(V))
76 if (
A->hasByValAttr() ||
A->hasNoAliasAttr())
88 if (isa<CallInst>(V) || isa<InvokeInst>(V) || isa<Argument>(V))
104 bool RoundToAlign =
false) {
171 struct VariableGEPIndex {
177 return V == Other.V && Extension == Other.Extension &&
178 Scale == Other.Scale;
210 if (
ConstantInt *RHSC = dyn_cast<ConstantInt>(BOp->getOperand(1))) {
211 switch (BOp->getOpcode()) {
220 case Instruction::Add:
222 DL, Depth + 1, AC, DT);
223 Offset += RHSC->getValue();
225 case Instruction::Mul:
227 DL, Depth + 1, AC, DT);
228 Offset *= RHSC->getValue();
229 Scale *= RHSC->getValue();
231 case Instruction::Shl:
233 DL, Depth + 1, AC, DT);
234 Offset <<= RHSC->getValue().getLimitedValue();
244 if ((isa<SExtInst>(V) && Extension != EK_ZeroExt) ||
245 (isa<ZExtInst>(V) && Extension != EK_SignExt)) {
246 Value *CastOp = cast<CastInst>(V)->getOperand(0);
249 Scale = Scale.
trunc(SmallWidth);
250 Offset = Offset.
trunc(SmallWidth);
251 Extension = isa<SExtInst>(V) ? EK_SignExt : EK_ZeroExt;
255 Scale = Scale.
zext(OldWidth);
256 Offset = Offset.
zext(OldWidth);
288 MaxLookupReached =
false;
296 if (
const GlobalAlias *GA = dyn_cast<GlobalAlias>(V)) {
297 if (!GA->mayBeOverridden()) {
298 V = GA->getAliasee();
305 if (Op->
getOpcode() == Instruction::BitCast ||
306 Op->
getOpcode() == Instruction::AddrSpaceCast) {
340 if (
StructType *STy = dyn_cast<StructType>(*GTI++)) {
342 unsigned FieldNo = cast<ConstantInt>(Index)->getZExtValue();
343 if (FieldNo == 0)
continue;
350 if (
ConstantInt *CIdx = dyn_cast<ConstantInt>(Index)) {
351 if (CIdx->isZero())
continue;
363 Extension = EK_SignExt;
366 APInt IndexScale(Width, 0), IndexOffset(Width, 0);
373 Scale *= IndexScale.getSExtValue();
379 for (
unsigned i = 0, e = VarIndices.
size(); i != e; ++i) {
380 if (VarIndices[i].V == Index &&
381 VarIndices[i].Extension == Extension) {
382 Scale += VarIndices[i].Scale;
392 Scale = (int64_t)Scale >> ShiftBits;
396 VariableGEPIndex Entry = {Index, Extension,
397 static_cast<int64_t
>(Scale)};
404 }
while (--MaxLookup);
407 MaxLookupReached =
true;
417 if (
const Instruction *inst = dyn_cast<Instruction>(V))
420 if (
const Argument *arg = dyn_cast<Argument>(V))
421 return arg->getParent();
431 return !F1 || !F2 || F1 == F2;
443 bool doInitialization(
Module &M)
override;
453 assert(AliasCache.empty() &&
"AliasCache must be cleared after use!");
455 "BasicAliasAnalysis doesn't support interprocedural queries.");
462 AliasCache.shrink_and_clear();
463 VisitedPhiBBs.clear();
476 bool OrLocal)
override;
480 unsigned ArgIdx)
override;
494 void *getAdjustedAnalysisPointer(
const void *
ID)
override {
502 typedef std::pair<MemoryLocation, MemoryLocation> LocPair;
504 AliasCacheTy AliasCache;
530 bool isValueEqualInPotentialCycles(
const Value *V1,
const Value *
V2);
543 const Value *
V2, uint64_t V2Size,
545 const Value *UnderlyingV1,
const Value *UnderlyingV2);
551 const Value *
V2, uint64_t V2Size,
557 const Value *
V2, uint64_t V2Size,
562 const Value *
V2, uint64_t V2Size,
570 "Basic Alias Analysis (stateless AA impl)",
580 return new BasicAliasAnalysis();
586 bool BasicAliasAnalysis::pointsToConstantMemory(
const MemoryLocation &Loc,
588 assert(Visited.empty() &&
"Visited must be cleared after use!");
590 unsigned MaxLookup = 8;
595 if (!Visited.insert(V).second) {
601 if (OrLocal && isa<AllocaInst>(V))
609 if (!GV->isConstant()) {
617 if (
const SelectInst *SI = dyn_cast<SelectInst>(V)) {
625 if (
const PHINode *PN = dyn_cast<PHINode>(V)) {
627 if (PN->getNumIncomingValues() > MaxLookup) {
631 for (
Value *IncValue : PN->incoming_values())
640 }
while (!Worklist.
empty() && --MaxLookup);
643 return Worklist.
empty();
650 if (TLI.
has(LibFunc::memset_pattern16) &&
651 MS->
getName() ==
"memset_pattern16") {
668 return DoesNotAccessMemory;
675 Min = OnlyReadsMemory;
687 BasicAliasAnalysis::getModRefBehavior(
const Function *
F) {
690 return DoesNotAccessMemory;
694 #define GET_INTRINSIC_MODREF_BEHAVIOR
695 #include "llvm/IR/Intrinsics.gen"
696 #undef GET_INTRINSIC_MODREF_BEHAVIOR
703 Min = OnlyReadsMemory;
709 getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
711 Min = OnlyAccessesArgumentPointees;
720 switch (II->getIntrinsicID()) {
723 case Intrinsic::memset:
724 case Intrinsic::memcpy:
725 case Intrinsic::memmove:
726 assert((ArgIdx == 0 || ArgIdx == 1) &&
727 "Invalid argument index for memory intrinsic");
728 return ArgIdx ? Ref : Mod;
737 assert((ArgIdx == 0 || ArgIdx == 1) &&
738 "Invalid argument index for memset_pattern16");
739 return ArgIdx ? Ref : Mod;
754 bool BasicAliasAnalysis::doInitialization(
Module &M) {
767 "AliasAnalysis query involving multiple functions!");
776 if (isa<AllocaInst>(Object))
778 if (CI->isTailCall())
786 bool PassedAsArg =
false;
789 CI !=
CE; ++CI, ++ArgNo) {
793 if (!(*CI)->getType()->isPointerTy() ||
843 "Expected GEPs with the same pointer operand");
866 if (!C1 || !C2 || C1 == C2)
877 assert(GEP1->
getNumIndices() > 1 &&
"Not enough GEP indices to examine");
882 for (
unsigned i = 1, e = GEP1->
getNumIndices() - 1; i != e; ++i) {
893 if (!LastIndexedStruct)
914 auto EltsDontOverlap = [StructSize](uint64_t V1Off, uint64_t V1Size,
915 uint64_t V2Off, uint64_t V2Size) {
916 return V1Off < V2Off && V1Off + V1Size <= V2Off &&
917 ((V2Off + V2Size <= StructSize) ||
918 (V2Off + V2Size - StructSize <= V1Off));
921 if (EltsDontOverlap(V1Off, V1Size, V2Off, V2Size) ||
922 EltsDontOverlap(V2Off, V2Size, V1Off, V1Size))
936 const Value *UnderlyingV1,
const Value *UnderlyingV2) {
937 int64_t GEP1BaseOffset;
938 bool GEP1MaxLookupReached;
950 if (
auto *GEP1I = dyn_cast<Instruction>(GEP1))
952 const_cast<Function &>(*GEP1I->getParent()->getParent()));
953 if (
auto *I2 = dyn_cast<Instruction>(V2))
955 const_cast<Function &>(*I2->getParent()->getParent()));
958 getAnalysisIfAvailable<DominatorTreeWrapperPass>();
964 if (
const GEPOperator *GEP2 = dyn_cast<GEPOperator>(V2)) {
972 if ((BaseAlias ==
MayAlias) && V1Size == V2Size) {
974 AliasResult PreciseBaseAlias = aliasCheck(UnderlyingV1, V1Size,
975 V1AAInfo, UnderlyingV2,
977 if (PreciseBaseAlias ==
NoAlias) {
980 int64_t GEP2BaseOffset;
981 bool GEP2MaxLookupReached;
983 const Value *GEP2BasePtr =
985 GEP2MaxLookupReached, *DL, AC2, DT);
986 const Value *GEP1BasePtr =
988 GEP1MaxLookupReached, *DL, AC1, DT);
991 if (GEP1BasePtr != UnderlyingV1 || GEP2BasePtr != UnderlyingV2) {
993 "DecomposeGEPExpression and GetUnderlyingObject disagree!");
997 if (GEP2MaxLookupReached || GEP1MaxLookupReached)
1001 if (GEP1BaseOffset == GEP2BaseOffset &&
1002 GEP1VariableIndices == GEP2VariableIndices)
1004 GEP1VariableIndices.
clear();
1010 if (BaseAlias !=
MustAlias)
return BaseAlias;
1015 const Value *GEP1BasePtr =
1017 GEP1MaxLookupReached, *DL, AC1, DT);
1019 int64_t GEP2BaseOffset;
1020 bool GEP2MaxLookupReached;
1022 const Value *GEP2BasePtr =
1024 GEP2MaxLookupReached, *DL, AC2, DT);
1028 if (GEP1BasePtr != UnderlyingV1 || GEP2BasePtr != UnderlyingV2) {
1030 "DecomposeGEPExpression and GetUnderlyingObject disagree!");
1045 if (GEP2MaxLookupReached || GEP1MaxLookupReached)
1050 GEP1BaseOffset -= GEP2BaseOffset;
1051 GetIndexDifference(GEP1VariableIndices, GEP2VariableIndices);
1073 const Value *GEP1BasePtr =
1075 GEP1MaxLookupReached, *DL, AC1, DT);
1079 if (GEP1BasePtr != UnderlyingV1) {
1081 "DecomposeGEPExpression and GetUnderlyingObject disagree!");
1085 if (GEP1MaxLookupReached)
1095 if (GEP1BaseOffset == 0 && GEP1VariableIndices.
empty())
1102 if (GEP1BaseOffset != 0 && GEP1VariableIndices.
empty()) {
1103 if (GEP1BaseOffset >= 0) {
1105 if ((uint64_t)GEP1BaseOffset < V2Size)
1120 if (-(uint64_t)GEP1BaseOffset < V1Size)
1129 if (!GEP1VariableIndices.
empty()) {
1130 uint64_t Modulo = 0;
1131 for (
unsigned i = 0, e = GEP1VariableIndices.
size(); i != e; ++i)
1132 Modulo |= (uint64_t) GEP1VariableIndices[i].Scale;
1133 Modulo = Modulo ^ (Modulo & (Modulo - 1));
1138 uint64_t ModOffset = (uint64_t)GEP1BaseOffset & (Modulo - 1);
1141 V1Size <= Modulo - ModOffset)
1172 const Value *V2, uint64_t V2Size,
1176 if (
const SelectInst *SI2 = dyn_cast<SelectInst>(V2))
1180 SI2->getTrueValue(), V2Size, V2AAInfo);
1185 SI2->getFalseValue(), V2Size, V2AAInfo);
1192 aliasCheck(V2, V2Size, V2AAInfo, SI->
getTrueValue(), SISize, SIAAInfo);
1197 aliasCheck(V2, V2Size, V2AAInfo, SI->
getFalseValue(), SISize, SIAAInfo);
1205 const Value *V2, uint64_t V2Size,
1214 if (
const PHINode *PN2 = dyn_cast<PHINode>(V2))
1215 if (PN2->getParent() == PN->
getParent()) {
1228 assert(AliasCache.count(Locs) &&
1229 "There must exist an entry for the phi node");
1245 AliasCache[Locs] = OrigAliasResult;
1253 if (isa<PHINode>(PV1))
1259 if (UniqueSrc.
insert(PV1).second)
1263 AliasResult Alias = aliasCheck(V2, V2Size, V2AAInfo,
1264 V1Srcs[0], PNSize, PNAAInfo);
1272 for (
unsigned i = 1, e = V1Srcs.
size(); i != e; ++i) {
1273 Value *V = V1Srcs[i];
1275 AliasResult ThisAlias = aliasCheck(V2, V2Size, V2AAInfo,
1276 V, PNSize, PNAAInfo);
1288 AliasResult BasicAliasAnalysis::aliasCheck(
const Value *V1, uint64_t V1Size,
1294 if (V1Size == 0 || V2Size == 0)
1303 if (isa<UndefValue>(V1) || isa<UndefValue>(V2))
1312 if (isValueEqualInPotentialCycles(V1, V2))
1325 if (CPN->getType()->getAddressSpace() == 0)
1328 if (CPN->getType()->getAddressSpace() == 0)
1382 std::pair<AliasCacheTy::iterator, bool> Pair =
1383 AliasCache.insert(std::make_pair(Locs,
MayAlias));
1385 return Pair.first->second;
1389 if (!isa<GEPOperator>(V1) && isa<GEPOperator>(V2)) {
1395 if (
const GEPOperator *GV1 = dyn_cast<GEPOperator>(V1)) {
1396 AliasResult Result = aliasGEP(GV1, V1Size, V1AAInfo, V2, V2Size, V2AAInfo, O1, O2);
1397 if (Result !=
MayAlias)
return AliasCache[Locs] = Result;
1400 if (isa<PHINode>(V2) && !isa<PHINode>(V1)) {
1405 if (
const PHINode *PN = dyn_cast<PHINode>(V1)) {
1406 AliasResult Result = aliasPHI(PN, V1Size, V1AAInfo,
1407 V2, V2Size, V2AAInfo);
1408 if (Result !=
MayAlias)
return AliasCache[Locs] = Result;
1411 if (isa<SelectInst>(V2) && !isa<SelectInst>(V1)) {
1416 if (
const SelectInst *S1 = dyn_cast<SelectInst>(V1)) {
1417 AliasResult Result = aliasSelect(S1, V1Size, V1AAInfo,
1418 V2, V2Size, V2AAInfo);
1419 if (Result !=
MayAlias)
return AliasCache[Locs] = Result;
1435 return AliasCache[Locs] = Result;
1438 bool BasicAliasAnalysis::isValueEqualInPotentialCycles(
const Value *V,
1447 if (VisitedPhiBBs.empty())
1455 getAnalysisIfAvailable<DominatorTreeWrapperPass>();
1457 auto *LIWP = getAnalysisIfAvailable<LoopInfoWrapperPass>();
1458 LoopInfo *LI = LIWP ? &LIWP->getLoopInfo() :
nullptr;
1463 for (
auto *
P : VisitedPhiBBs)
1474 void BasicAliasAnalysis::GetIndexDifference(
1480 for (
unsigned i = 0, e = Src.
size(); i != e; ++i) {
1481 const Value *V = Src[i].V;
1483 int64_t Scale = Src[i].Scale;
1487 for (
unsigned j = 0, e = Dest.
size(); j != e; ++j) {
1488 if (!isValueEqualInPotentialCycles(Dest[j].V, V) ||
1489 Dest[j].Extension != Extension)
1494 if (Dest[j].Scale != Scale)
1495 Dest[j].Scale -= Scale;
1504 VariableGEPIndex Entry = { V, Extension, -Scale };
static Value * GetLinearExpression(Value *V, APInt &Scale, APInt &Offset, ExtensionKind &Extension, const DataLayout &DL, unsigned Depth, AssumptionCache *AC, DominatorTree *DT)
GetLinearExpression - Analyze the specified value as a linear expression: "A*V + B", where A and B are constant integers.
The two locations precisely alias each other.
static const unsigned MaxLookupSearchDepth
Type * getSourceElementType() const
void push_back(const T &Elt)
Basic Alias Analysis(stateless AA impl)"
A parsed version of the target data layout string in and methods for querying it. ...
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
LLVM Argument representation.
bool onlyReadsMemory() const
Determine if the function does not access or only reads memory.
A Module instance is used to store all the information related to an LLVM module. ...
unsigned getNumParams() const
getNumParams - Return the number of fixed parameters this function type requires. ...
InstrTy * getInstruction() const
Intrinsic::ID getIntrinsicID() const
getIntrinsicID - Return the intrinsic ID of this intrinsic.
unsigned getNumOperands() const
The two locations alias, but only due to a partial overlap.
bool getObjectSize(const Value *Ptr, uint64_t &Size, const DataLayout &DL, const TargetLibraryInfo *TLI, bool RoundToAlign=false)
Compute the size of the object pointed by Ptr.
ModRefBehavior
ModRefBehavior - Summary of how a function affects memory in the program.
CallInst - This class represents a function call, abstracting a target machine's calling convention...
static bool isEscapeSource(const Value *V)
isEscapeSource - Return true if the pointer is one which would have been considered an escape by isNo...
An immutable pass that tracks lazily created AssumptionCache objects.
A cache of .assume calls within a function.
uint64_t getLimitedValue(uint64_t Limit=~0ULL) const
If this value is smaller than the specified limit, return it, otherwise return the limit value...
The two locations do not alias at all.
bool isNoAliasCall(const Value *V)
isNoAliasCall - Return true if this pointer is returned by a noalias function.
User::const_op_iterator arg_iterator
arg_iterator - The type of iterator to use when looping over actual arguments at this call site...
The two locations may or may not alias. This is the least precise result.
Type * getPointerElementType() const
virtual bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal=false)
pointsToConstantMemory - If the specified memory location is known to be constant, return true.
StringRef getName() const
Return a constant reference to the value's name.
AnalysisUsage & addRequired()
Used to lazily calculate structure layout information for a target machine, based on the DataLayout s...
#define INITIALIZE_PASS_DEPENDENCY(depName)
SelectInst - This class represents the LLVM 'select' instruction.
const StructLayout * getStructLayout(StructType *Ty) const
Returns a StructLayout object, indicating the alignment of the struct, its size, and the offsets of i...
bool has(LibFunc::Func F) const
Tests whether a library function is available.
T LLVM_ATTRIBUTE_UNUSED_RESULT pop_back_val()
StructType - Class to represent struct types.
A Use represents the edge between a Value definition and its users.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
const unsigned MaxNumPhiBBsValueReachabilityCheck
Cutoff after which to stop analysing a set of phi nodes potentially involved in a cycle...
bool isSized(SmallPtrSetImpl< const Type * > *Visited=nullptr) const
isSized - Return true if it makes sense to take the size of this type.
bool MaskedValueIsZero(Value *V, const APInt &Mask, const DataLayout &DL, unsigned Depth=0, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr, const DominatorTree *DT=nullptr)
MaskedValueIsZero - Return true if 'V & Mask' is known to be zero.
static AliasResult MergeAliasResults(AliasResult A, AliasResult B)
DominatorTree & getDomTree()
Windows NT (Windows on ARM)
virtual ModRefResult getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx)
Get the ModRef info associated with a pointer argument of a callsite.
bool isIdentifiedObject(const Value *V)
isIdentifiedObject - Return true if this pointer refers to a distinct and identifiable object...
uint64_t getZExtValue() const
Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate...
place backedge safepoints impl
FunctionType - Class to represent function types.
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
ImmutablePass * createBasicAliasAnalysisPass()
INITIALIZE_AG_PASS_BEGIN(BasicAliasAnalysis, AliasAnalysis,"basicaa","Basic Alias Analysis (stateless AA impl)", false, true, false) INITIALIZE_AG_PASS_END(BasicAliasAnalysis
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
bool doesNotAccessMemory() const
Determine if the function does not access memory.
static bool isObjectSize(const Value *V, uint64_t Size, const DataLayout &DL, const TargetLibraryInfo &TLI)
isObjectSize - Return true if we can prove that the object specified by V has size Size...
static bool isMemsetPattern16(const Function *MS, const TargetLibraryInfo &TLI)
unsigned getNumIncomingValues() const
getNumIncomingValues - Return the number of incoming edges
uint64_t getElementOffset(unsigned Idx) const
bool doesNotAccessMemory() const
Determine if the call does not access memory.
Type * getParamType(unsigned i) const
Parameter type accessors.
APInt LLVM_ATTRIBUTE_UNUSED_RESULT trunc(unsigned width) const
Truncate to new width.
FunTy * getCalledFunction() const
getCalledFunction - Return the function being called if this is a direct call, otherwise return null ...
const Value * getCondition() const
int64_t getSExtValue() const
Get sign extended value.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
bool isByValArgument(unsigned ArgNo) const
Determine whether this argument is passed by value.
APInt Or(const APInt &LHS, const APInt &RHS)
Bitwise OR function for APInt.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
AliasResult
The possible results of an alias query.
Represent the analysis usage information of a pass.
BasicBlock * getIncomingBlock(unsigned i) const
getIncomingBlock - Return incoming basic block number i.
unsigned getBitWidth() const
Return the number of bits in the APInt.
Value * getPointerOperand()
Value * getOperand(unsigned i) const
bool isPotentiallyReachable(const Instruction *From, const Instruction *To, const DominatorTree *DT=nullptr, const LoopInfo *LI=nullptr)
Determine whether instruction 'To' is reachable from 'From', returning true if uncertain.
static bool isNonEscapingLocalObject(const Value *V)
isNonEscapingLocalObject - Return true if the pointer is to a function-local object that never escape...
bool isPointerTy() const
isPointerTy - True if this is an instance of PointerType.
iterator erase(iterator I)
bool PointerMayBeCaptured(const Value *V, bool ReturnCaptures, bool StoreCaptures)
PointerMayBeCaptured - Return true if this pointer value may be captured by the enclosing function (w...
void initializeBasicAliasAnalysisPass(PassRegistry &)
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 p...
static bool isAssumeIntrinsic(ImmutableCallSite CS)
virtual ModRefBehavior getModRefBehavior(ImmutableCallSite CS)
getModRefBehavior - Return the behavior when calling the given call site.
const Value * getTrueValue() const
bool onlyAccessesArgMemory() const
Determine if the call can access memmory only using pointers based on its arguments.
Value * GetUnderlyingObject(Value *V, const DataLayout &DL, unsigned MaxLookup=6)
GetUnderlyingObject - This method strips off any GEP address adjustments and pointer casts from the s...
bool isIdentifiedFunctionLocal(const Value *V)
isIdentifiedFunctionLocal - Return true if V is umabigously identified at the function-level.
const Value * Ptr
The address of the start of the location.
Representation for a specific memory location.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
unsigned getIntegerBitWidth() const
This is the shared class of boolean and integer constants.
ImmutablePass class - This class is used to provide information that does not need to be run...
Value * getIncomingValue(unsigned i) const
getIncomingValue - Return incoming value number x
uint64_t getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
unsigned getNumIndices() const
virtual AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB)
Alias Queries...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
This is a utility class that provides an abstraction for the common functionality between Instruction...
Type * getType() const
All values are typed, get the type of this value.
static bool isObjectSmallerThan(const Value *V, uint64_t Size, const DataLayout &DL, const TargetLibraryInfo &TLI)
isObjectSmallerThan - Return true if we can prove that the object specified by V is smaller than Size...
Provides information about what library functions are available for the current target.
ConstantPointerNull - a constant pointer value that points to null.
ModRefResult getModRefInfo(const Instruction *I)
getModRefInfo - Return information about whether or not an instruction may read or write memory (with...
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
uint64_t getSizeInBytes() const
Value * stripPointerCasts()
Strip off pointer casts, all-zero GEPs, and aliases.
Intrinsic::ID getIntrinsicID() const LLVM_READONLY
getIntrinsicID - This method returns the ID number of the specified function, or Intrinsic::not_intri...
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Class for arbitrary precision integers.
static bool notDifferentParent(const Value *O1, const Value *O2)
bool isIntegerTy() const
isIntegerTy - True if this is an instance of IntegerType.
LLVM_ATTRIBUTE_UNUSED_RESULT std::enable_if< !is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
bool isKnownNonNull(const Value *V, const TargetLibraryInfo *TLI=nullptr)
isKnownNonNull - Return true if this pointer couldn't possibly be null by its definition.
unsigned getOpcode() const
Return the opcode for this Instruction or ConstantExpr.
static Type * getIndexedType(Type *Ty, ArrayRef< Value * > IdxList)
getIndexedType - Returns the type of the element that would be loaded with a load instruction with th...
bool operator!=(uint64_t V1, const APInt &V2)
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
AAMDNodes AATags
The metadata nodes which describes the aliasing of the location (each member is null if that kind of ...
bool doesNotCapture(unsigned ArgNo) const
Determine whether this argument is not captured.
ImmutableCallSite - establish a view to a call site for examination.
FunctionType * getFunctionType() const
unsigned getPointerSizeInBits(unsigned AS=0) const
Layout pointer size, in bits FIXME: The defaults need to be removed once all of the backends/clients ...
unsigned getPointerAddressSpace() const
Method to return the address space of the pointer operand.
static const Value * DecomposeGEPExpression(const Value *V, int64_t &BaseOffs, SmallVectorImpl< VariableGEPIndex > &VarIndices, bool &MaxLookupReached, const DataLayout &DL, AssumptionCache *AC, DominatorTree *DT)
DecomposeGEPExpression - If V is a symbolic pointer expression, decompose it into a base pointer with...
unsigned getPrimitiveSizeInBits() const LLVM_READONLY
getPrimitiveSizeInBits - Return the basic size of this type if it is a primitive type.
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
ModRefResult
Simple mod/ref information...
static const Function * getParent(const Value *V)
AssumptionCache & getAssumptionCache(Function &F)
Get the cached assumptions for a function.
IterTy arg_begin() const
arg_begin/arg_end - Return iterators corresponding to the actual argument list for a call site...
#define INITIALIZE_AG_PASS_END(passName, agName, arg, n, cfg, analysis, def)
const Value * getFalseValue() const
APInt LLVM_ATTRIBUTE_UNUSED_RESULT zext(unsigned width) const
Zero extend to a new width.
Value * SimplifyInstruction(Instruction *I, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const DominatorTree *DT=nullptr, AssumptionCache *AC=nullptr)
SimplifyInstruction - See if we can compute a simplified version of this instruction.
Legacy analysis pass which computes a DominatorTree.
bool operator==(uint64_t V1, const APInt &V2)
op_range incoming_values()
const BasicBlock * getParent() const
bool onlyReadsMemory() const
Determine if the call does not access or only reads memory.
IntrinsicInst - A useful wrapper class for inspecting calls to intrinsic functions.
gep_type_iterator gep_type_begin(const User *GEP)
uint64_t Size
The maximum size of the location, in address-units, or UnknownSize if the size is not known...
bool onlyAccessesArgMemory() const
Determine if the call can access memmory only using pointers based on its arguments.