47 if (isa<BinaryOperator>(A) || isa<CastInst>(A) || isa<PHINode>(A) ||
48 isa<GetElementPtrInst>(A))
49 if (
const Instruction *BI = dyn_cast<Instruction>(B))
50 if (cast<Instruction>(A)->isIdenticalToWhenDefined(BI))
74 int64_t ByteOffset = 0;
81 Type *BaseType =
nullptr;
82 unsigned BaseAlign = 0;
83 if (
const AllocaInst *AI = dyn_cast<AllocaInst>(Base)) {
85 BaseType = AI->getAllocatedType();
86 BaseAlign = AI->getAlignment();
87 }
else if (
const GlobalVariable *GV = dyn_cast<GlobalVariable>(Base)) {
91 if (!GV->mayBeOverridden()) {
92 BaseType = GV->getType()->getElementType();
93 BaseAlign = GV->getAlignment();
104 if (BaseType && BaseType->
isSized()) {
108 if (Align <= BaseAlign) {
111 ((ByteOffset %
Align) == 0))
132 if (isa<CallInst>(BBI) && BBI->mayWriteToMemory() &&
133 !isa<DbgInfoIntrinsic>(BBI))
137 unsigned AccessedAlign;
138 if (
LoadInst *LI = dyn_cast<LoadInst>(BBI)) {
139 AccessedPtr = LI->getPointerOperand();
140 AccessedAlign = LI->getAlignment();
141 }
else if (
StoreInst *
SI = dyn_cast<StoreInst>(BBI)) {
142 AccessedPtr =
SI->getPointerOperand();
143 AccessedAlign =
SI->getAlignment();
148 if (AccessedAlign == 0)
150 if (AccessedAlign < Align)
154 if (AccessedPtr == V)
185 unsigned MaxInstsToScan,
187 if (MaxInstsToScan == 0)
188 MaxInstsToScan = ~0U;
190 Type *AccessTy = cast<PointerType>(Ptr->
getType())->getElementType();
199 while (ScanFrom != ScanBB->
begin()) {
203 if (isa<DbgInfoIntrinsic>(Inst))
210 if (MaxInstsToScan-- == 0)
217 if (
LoadInst *LI = dyn_cast<LoadInst>(Inst))
219 LI->getPointerOperand()->stripPointerCasts(), StrippedPtr) &&
222 LI->getAAMetadata(*AATags);
227 Value *StorePtr =
SI->getPointerOperand()->stripPointerCasts();
235 SI->getAAMetadata(*AATags);
236 return SI->getOperand(0);
242 if ((isa<AllocaInst>(StrippedPtr) || isa<GlobalVariable>(StrippedPtr)) &&
243 (isa<AllocaInst>(StorePtr) || isa<GlobalVariable>(StorePtr)) &&
244 StrippedPtr != StorePtr)
A parsed version of the target data layout string in and methods for querying it. ...
unsigned getPrefTypeAlignment(Type *Ty) const
Returns the preferred stack/global alignment for the specified type.
LoadInst - an instruction for reading from memory.
Type * getPointerElementType() const
static bool isBitOrNoopPointerCastable(Type *SrcTy, Type *DestTy, const DataLayout &DL)
Check whether a bitcast, inttoptr, or ptrtoint cast between these types is valid and a no-op...
iterator begin()
Instruction iterator methods.
const Module * getModule() const
Return the module owning the function this basic block belongs to, or nullptr it the function does no...
bool isSized(SmallPtrSetImpl< const Type * > *Visited=nullptr) const
isSized - Return true if it makes sense to take the size of this type.
Value * GetPointerBaseWithConstantOffset(Value *Ptr, int64_t &Offset, const DataLayout &DL)
GetPointerBaseWithConstantOffset - Analyze the specified pointer to see if it can be expressed as a b...
StoreInst - an instruction for storing to memory.
Type * getElementType() const
PointerType - Class to represent pointers.
LLVM Basic Block Representation.
The instances of the Type class are immutable: once they are created, they are never changed...
bool mayWriteToMemory() const
mayWriteToMemory - Return true if this instruction may modify memory.
unsigned getABITypeAlignment(Type *Ty) const
Returns the minimum ABI-required alignment for the specified type.
uint64_t getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
const Module * getModule() const
Return the module owning the function this instruction belongs to or nullptr it the function does not...
Module.h This file contains the declarations for the Module class.
Type * getType() const
All values are typed, get the type of this value.
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...
Value * stripPointerCasts()
Strip off pointer casts, all-zero GEPs, and aliases.
static cl::opt< AlignMode > Align(cl::desc("Load/store alignment support"), cl::Hidden, cl::init(NoStrictAlign), cl::values(clEnumValN(StrictAlign,"aarch64-strict-align","Disallow all unaligned memory accesses"), clEnumValN(NoStrictAlign,"aarch64-no-strict-align","Allow unaligned memory accesses"), clEnumValEnd))
static bool AreEquivalentAddressValues(const Value *A, const Value *B)
Test if A and B will obviously have the same value.
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
uint64_t getTypeStoreSize(Type *Ty) const
Returns the maximum number of bytes that may be overwritten by storing the specified type...
Value * FindAvailableLoadedValue(Value *Ptr, BasicBlock *ScanBB, BasicBlock::iterator &ScanFrom, unsigned MaxInstsToScan=6, AliasAnalysis *AA=nullptr, AAMDNodes *AATags=nullptr)
FindAvailableLoadedValue - Scan the ScanBB block backwards (starting at the instruction before ScanFr...
LLVM Value Representation.
bool isSafeToLoadUnconditionally(Value *V, Instruction *ScanFrom, unsigned Align)
isSafeToLoadUnconditionally - Return true if we know that executing a load from this value cannot tra...
bool isPowerOf2_32(uint32_t Value)
isPowerOf2_32 - This function returns true if the argument is a power of two > 0. ...
const BasicBlock * getParent() const
AllocaInst - an instruction to allocate memory on the stack.