17 #define DEBUG_TYPE "memdep"
36 STATISTIC(NumCacheNonLocal,
"Number of fully cached non-local responses");
37 STATISTIC(NumCacheDirtyNonLocal,
"Number of dirty cached non-local responses");
38 STATISTIC(NumUncacheNonLocal,
"Number of uncached non-local responses");
41 "Number of fully cached non-local ptr responses");
43 "Number of cached, but dirty, non-local ptr responses");
45 "Number of uncached non-local ptr responses");
47 "Number of block queries that were completely cached");
56 "Memory Dependence Analysis",
false,
true)
61 MemoryDependenceAnalysis::MemoryDependenceAnalysis()
72 NonLocalPointerDeps.
clear();
73 ReverseLocalDeps.
clear();
74 ReverseNonLocalDeps.
clear();
75 ReverseNonLocalPtrDeps.
clear();
89 AA = &getAnalysis<AliasAnalysis>();
90 TD = getAnalysisIfAvailable<DataLayout>();
91 DT = getAnalysisIfAvailable<DominatorTree>();
99 template <
typename KeyTy>
104 InstIt = ReverseMap.
find(Inst);
105 assert(InstIt != ReverseMap.
end() &&
"Reverse map out of sync?");
106 bool Found = InstIt->second.
erase(Val);
107 assert(Found &&
"Invalid reverse map!"); (void)Found;
108 if (InstIt->second.
empty())
109 ReverseMap.erase(InstIt);
120 if (
const LoadInst *
LI = dyn_cast<LoadInst>(Inst)) {
121 if (
LI->isUnordered()) {
133 if (
const StoreInst *SI = dyn_cast<StoreInst>(Inst)) {
134 if (SI->isUnordered()) {
146 if (
const VAArgInst *V = dyn_cast<VAArgInst>(Inst)) {
158 switch (II->getIntrinsicID()) {
163 cast<ConstantInt>(II->getArgOperand(0))
171 cast<ConstantInt>(II->getArgOperand(1))
192 getCallSiteDependencyFrom(
CallSite CS,
bool isReadOnlyCall,
197 while (ScanIt != BB->
begin()) {
216 if (
CallSite InstCS = cast<Value>(Inst)) {
218 if (isa<DbgInfoIntrinsic>(Inst))
continue;
256 const Value *&MemLocBase,
261 if (TD == 0)
return false;
295 const Value *LIBase =
300 if (LIBase != MemLocBase)
return 0;
309 if (MemLocOffs < LIOffs)
return 0;
318 int64_t MemLocEnd = MemLocOffs+MemLocSize;
321 if (LIOffs+LoadAlign < MemLocEnd)
return 0;
331 if (NewLoadByteSize > LoadAlign ||
335 if (LIOffs+NewLoadByteSize > MemLocEnd &&
344 if (LIOffs+NewLoadByteSize >= MemLocEnd)
345 return NewLoadByteSize;
347 NewLoadByteSize <<= 1;
362 const Value *MemLocBase = 0;
363 int64_t MemLocOffset = 0;
365 bool isInvariantLoad =
false;
366 if (isLoad && QueryInst) {
369 isInvariantLoad =
true;
373 while (ScanIt != BB->
begin()) {
378 if (isa<DbgInfoIntrinsic>(II))
continue;
403 if (
LoadInst *
LI = dyn_cast<LoadInst>(Inst)) {
406 if (!
LI->isUnordered())
423 if (
LI->getAlignment()*8 > ITy->getPrimitiveSizeInBits() &&
425 MemLocOffset,
LI, TD))
435 #if 0 // FIXME: Temporarily disabled. GVN is cleverly rewriting loads
463 if (
StoreInst *SI = dyn_cast<StoreInst>(Inst)) {
466 if (!SI->isUnordered())
500 if (isa<AllocaInst>(Inst) ||
isNoAliasFn(Inst, TLI)) {
503 if (AccessPtr == Inst || AA->
isMustAlias(Inst, AccessPtr))
510 if (isa<AllocaInst>(Inst) ||
524 case AliasAnalysis::Mod:
554 if (!LocalCache.isDirty())
585 QueryParent, QueryInst);
586 }
else if (isa<CallInst>(QueryInst) || isa<InvokeInst>(QueryInst)) {
589 LocalCache = getCallSiteDependencyFrom(QueryCS, isReadOnly, ScanPos,
598 ReverseLocalDeps[
I].insert(QueryInst);
608 if (Count == -1) Count = Cache.size();
609 if (Count == 0)
return;
611 for (
unsigned i = 1; i !=
unsigned(Count); ++i)
612 assert(!(Cache[i] < Cache[i-1]) &&
"Cache isn't sorted!");
631 "getNonLocalCallDependency should only be used on calls with non-local deps!");
641 if (!Cache.empty()) {
644 if (!CacheP.second) {
651 for (NonLocalDepInfo::iterator
I = Cache.begin(), E = Cache.end();
653 if (
I->getResult().isDirty())
657 std::sort(Cache.begin(), Cache.end());
659 ++NumCacheDirtyNonLocal;
665 for (
BasicBlock **PI = PredCache->GetPreds(QueryBB); *PI; ++PI)
667 ++NumUncacheNonLocal;
675 unsigned NumSortedEntries = Cache.
size();
679 while (!DirtyBlocks.
empty()) {
684 if (!Visited.
insert(DirtyBB))
690 NonLocalDepInfo::iterator Entry =
691 std::upper_bound(Cache.begin(), Cache.begin()+NumSortedEntries,
693 if (Entry != Cache.begin() &&
prior(Entry)->getBB() == DirtyBB)
697 if (Entry != Cache.begin()+NumSortedEntries &&
698 Entry->getBB() == DirtyBB) {
701 if (!Entry->getResult().isDirty())
705 ExistingResult = &*Entry;
711 if (ExistingResult) {
723 if (ScanPos != DirtyBB->
begin()) {
724 Dep = getCallSiteDependencyFrom(QueryCS, isReadonlyCall,ScanPos, DirtyBB);
751 for (
BasicBlock **PI = PredCache->GetPreds(DirtyBB); *PI; ++PI)
771 "Can't get pointer deps of a non-pointer!");
781 if (!getNonLocalPointerDepFromBB(Address, Loc, isLoad, FromBB,
782 Result, Visited,
true))
787 const_cast<Value *>(Loc.
Ptr)));
797 NonLocalDepInfo *Cache,
unsigned NumSortedEntries) {
801 NonLocalDepInfo::iterator Entry =
802 std::upper_bound(Cache->begin(), Cache->begin()+NumSortedEntries,
804 if (Entry != Cache->begin() && (Entry-1)->getBB() == BB)
808 if (Entry != Cache->begin()+NumSortedEntries && Entry->getBB() == BB)
809 ExistingResult = &*Entry;
813 if (ExistingResult && !ExistingResult->
getResult().isDirty()) {
814 ++NumCacheNonLocalPtr;
824 "Instruction invalidated?");
825 ++NumCacheDirtyNonLocalPtr;
829 ValueIsLoadPair CacheKey(Loc.
Ptr, isLoad);
832 ++NumUncacheNonLocalPtr;
854 assert(Inst &&
"Didn't depend on anything?");
855 ValueIsLoadPair CacheKey(Loc.
Ptr, isLoad);
856 ReverseNonLocalPtrDeps[Inst].
insert(CacheKey);
865 unsigned NumSortedEntries) {
866 switch (Cache.size() - NumSortedEntries) {
874 MemoryDependenceAnalysis::NonLocalDepInfo::iterator Entry =
875 std::upper_bound(Cache.begin(), Cache.end()-1, Val);
876 Cache.insert(Entry, Val);
881 if (Cache.size() != 1) {
884 MemoryDependenceAnalysis::NonLocalDepInfo::iterator Entry =
885 std::upper_bound(Cache.begin(), Cache.end(), Val);
886 Cache.insert(Entry, Val);
891 std::sort(Cache.begin(), Cache.end());
908 bool MemoryDependenceAnalysis::
909 getNonLocalPointerDepFromBB(
const PHITransAddr &Pointer,
914 bool SkipFirstBlock) {
916 ValueIsLoadPair CacheKey(Pointer.
getAddr(), isLoad);
922 NonLocalPointerInfo InitialNLPI;
923 InitialNLPI.Size = Loc.
Size;
924 InitialNLPI.TBAATag = Loc.
TBAATag;
928 std::pair<CachedNonLocalPointerInfo::iterator, bool> Pair =
929 NonLocalPointerDeps.
insert(std::make_pair(CacheKey, InitialNLPI));
930 NonLocalPointerInfo *CacheInfo = &Pair.first->second;
935 if (CacheInfo->Size < Loc.
Size) {
938 CacheInfo->Pair = BBSkipFirstBlockPair();
939 CacheInfo->Size = Loc.
Size;
940 for (NonLocalDepInfo::iterator DI = CacheInfo->NonLocalDeps.begin(),
941 DE = CacheInfo->NonLocalDeps.end(); DI !=
DE; ++DI)
944 CacheInfo->NonLocalDeps.clear();
945 }
else if (CacheInfo->Size > Loc.
Size) {
948 return getNonLocalPointerDepFromBB(Pointer,
950 isLoad, StartBB, Result, Visited,
957 if (CacheInfo->TBAATag != Loc.
TBAATag) {
958 if (CacheInfo->TBAATag) {
959 CacheInfo->Pair = BBSkipFirstBlockPair();
960 CacheInfo->TBAATag = 0;
961 for (NonLocalDepInfo::iterator DI = CacheInfo->NonLocalDeps.begin(),
962 DE = CacheInfo->NonLocalDeps.end(); DI !=
DE; ++DI)
965 CacheInfo->NonLocalDeps.clear();
969 isLoad, StartBB, Result, Visited,
978 if (CacheInfo->Pair == BBSkipFirstBlockPair(StartBB, SkipFirstBlock)) {
984 if (!Visited.
empty()) {
985 for (NonLocalDepInfo::iterator
I = Cache->begin(), E = Cache->end();
988 if (VI == Visited.
end() || VI->second == Pointer.
getAddr())
999 for (NonLocalDepInfo::iterator
I = Cache->begin(), E = Cache->end();
1001 Visited.
insert(std::make_pair(
I->getBB(), Addr));
1002 if (
I->getResult().isNonLocal()) {
1014 ++NumCacheCompleteNonLocalPtr;
1023 CacheInfo->Pair = BBSkipFirstBlockPair(StartBB, SkipFirstBlock);
1025 CacheInfo->Pair = BBSkipFirstBlockPair();
1038 unsigned NumSortedEntries = Cache->size();
1041 while (!Worklist.
empty()) {
1045 if (!SkipFirstBlock) {
1048 assert(Visited.
count(BB) &&
"Should check 'visited' before adding to WL");
1053 MemDepResult Dep = GetNonLocalInfoForBlock(Loc, isLoad, BB, Cache,
1075 SkipFirstBlock =
false;
1077 for (
BasicBlock **PI = PredCache->GetPreds(BB); *PI; ++PI) {
1079 std::pair<DenseMap<BasicBlock*,Value*>::iterator,
bool>
1080 InsertRes = Visited.
insert(std::make_pair(*PI, Pointer.
getAddr()));
1081 if (InsertRes.second) {
1090 if (InsertRes.first->second != Pointer.
getAddr()) {
1093 for (
unsigned i = 0; i < NewBlocks.
size(); i++)
1094 Visited.
erase(NewBlocks[i]);
1095 goto PredTranslationFailure;
1105 goto PredTranslationFailure;
1112 if (Cache && NumSortedEntries != Cache->size()) {
1114 NumSortedEntries = Cache->size();
1119 for (
BasicBlock **PI = PredCache->GetPreds(BB); *PI; ++PI) {
1121 PredList.
push_back(std::make_pair(Pred, Pointer));
1135 std::pair<DenseMap<BasicBlock*,Value*>::iterator,
bool>
1136 InsertRes = Visited.
insert(std::make_pair(Pred, PredPtrVal));
1138 if (!InsertRes.second) {
1144 if (InsertRes.first->second == PredPtrVal)
1153 for (
unsigned i = 0, n = PredList.
size(); i < n; ++i)
1154 Visited.
erase(PredList[i].first);
1156 goto PredTranslationFailure;
1165 for (
unsigned i = 0, n = PredList.
size(); i < n; ++i) {
1170 bool CanTranslate =
true;
1175 if (PredPtrVal == 0)
1176 CanTranslate =
false;
1186 if (!CanTranslate ||
1187 getNonLocalPointerDepFromBB(PredPointer,
1193 Result.push_back(Entry);
1200 NonLocalPointerInfo &NLPI = NonLocalPointerDeps[CacheKey];
1201 NLPI.Pair = BBSkipFirstBlockPair();
1207 CacheInfo = &NonLocalPointerDeps[CacheKey];
1208 Cache = &CacheInfo->NonLocalDeps;
1209 NumSortedEntries = Cache->size();
1215 CacheInfo->Pair = BBSkipFirstBlockPair();
1216 SkipFirstBlock =
false;
1219 PredTranslationFailure:
1226 CacheInfo = &NonLocalPointerDeps[CacheKey];
1227 Cache = &CacheInfo->NonLocalDeps;
1228 NumSortedEntries = Cache->size();
1235 CacheInfo->Pair = BBSkipFirstBlockPair();
1246 assert(
I != Cache->rend() &&
"Didn't find current block??");
1247 if (
I->getBB() != BB)
1250 assert(
I->getResult().isNonLocal() &&
1251 "Should only be here with transparent block");
1267 void MemoryDependenceAnalysis::
1268 RemoveCachedNonLocalPointerDependencies(ValueIsLoadPair
P) {
1270 NonLocalPointerDeps.
find(P);
1271 if (It == NonLocalPointerDeps.
end())
return;
1277 for (
unsigned i = 0, e = PInfo.size(); i != e; ++i) {
1279 if (Target == 0)
continue;
1280 assert(Target->
getParent() == PInfo[i].getBB());
1287 NonLocalPointerDeps.
erase(It);
1320 if (NLDI != NonLocalDeps.
end()) {
1322 for (NonLocalDepInfo::iterator DI = BlockMap.begin(),
DE = BlockMap.end();
1324 if (
Instruction *Inst = DI->getResult().getInst())
1326 NonLocalDeps.
erase(NLDI);
1332 if (LocalDepEntry != LocalDeps.
end()) {
1334 if (
Instruction *Inst = LocalDepEntry->second.getInst())
1338 LocalDeps.
erase(LocalDepEntry);
1348 RemoveCachedNonLocalPointerDependencies(
ValueIsLoadPair(RemInst,
false));
1349 RemoveCachedNonLocalPointerDependencies(
ValueIsLoadPair(RemInst,
true));
1367 if (ReverseDepIt != ReverseLocalDeps.
end()) {
1370 assert(!ReverseDeps.
empty() && !isa<TerminatorInst>(RemInst) &&
1371 "Nothing can locally depend on a terminator");
1374 E = ReverseDeps.
end();
I != E; ++
I) {
1376 assert(InstDependingOnRemInst != RemInst &&
1377 "Already removed our local dep info");
1379 LocalDeps[InstDependingOnRemInst] = NewDirtyVal;
1382 assert(NewDirtyVal.
getInst() &&
"There is no way something else can have "
1383 "a local dep on this if it is a terminator!");
1385 InstDependingOnRemInst));
1388 ReverseLocalDeps.
erase(ReverseDepIt);
1392 while (!ReverseDepsToAdd.
empty()) {
1393 ReverseLocalDeps[ReverseDepsToAdd.
back().first]
1399 ReverseDepIt = ReverseNonLocalDeps.
find(RemInst);
1400 if (ReverseDepIt != ReverseNonLocalDeps.
end()) {
1404 assert(*
I != RemInst &&
"Already removed NonLocalDep info for RemInst");
1406 PerInstNLInfo &INLD = NonLocalDeps[*
I];
1410 for (NonLocalDepInfo::iterator DI = INLD.first.begin(),
1411 DE = INLD.first.end(); DI !=
DE; ++DI) {
1412 if (DI->getResult().getInst() != RemInst)
continue;
1415 DI->setResult(NewDirtyVal);
1418 ReverseDepsToAdd.
push_back(std::make_pair(NextI, *
I));
1422 ReverseNonLocalDeps.
erase(ReverseDepIt);
1425 while (!ReverseDepsToAdd.
empty()) {
1426 ReverseNonLocalDeps[ReverseDepsToAdd.
back().first]
1435 ReverseNonLocalPtrDeps.
find(RemInst);
1436 if (ReversePtrDepIt != ReverseNonLocalPtrDeps.
end()) {
1441 E = Set.
end();
I != E; ++
I) {
1444 "Already removed NonLocalPointerDeps info for RemInst");
1452 for (NonLocalDepInfo::iterator DI = NLPDI.begin(),
DE = NLPDI.end();
1454 if (DI->getResult().getInst() != RemInst)
continue;
1457 DI->setResult(NewDirtyVal);
1460 ReversePtrDepsToAdd.
push_back(std::make_pair(NewDirtyInst, P));
1465 std::sort(NLPDI.begin(), NLPDI.end());
1468 ReverseNonLocalPtrDeps.
erase(ReversePtrDepIt);
1470 while (!ReversePtrDepsToAdd.
empty()) {
1471 ReverseNonLocalPtrDeps[ReversePtrDepsToAdd.
back().first]
1478 assert(!NonLocalDeps.
count(RemInst) &&
"RemInst got reinserted?");
1480 DEBUG(verifyRemoved(RemInst));
1484 void MemoryDependenceAnalysis::verifyRemoved(
Instruction *D)
const {
1486 E = LocalDeps.
end();
I != E; ++
I) {
1487 assert(
I->first != D &&
"Inst occurs in data structures");
1488 assert(
I->second.getInst() != D &&
1489 "Inst occurs in data structures");
1493 E = NonLocalPointerDeps.
end();
I != E; ++
I) {
1494 assert(
I->first.getPointer() != D &&
"Inst occurs in NLPD map key");
1496 for (NonLocalDepInfo::const_iterator II = Val.begin(), E = Val.end();
1498 assert(II->getResult().getInst() != D &&
"Inst occurs as NLPD value");
1502 E = NonLocalDeps.
end();
I != E; ++
I) {
1503 assert(
I->first != D &&
"Inst occurs in data structures");
1504 const PerInstNLInfo &INLD =
I->second;
1505 for (NonLocalDepInfo::const_iterator II = INLD.first.begin(),
1506 EE = INLD.first.end(); II != EE; ++II)
1507 assert(II->getResult().getInst() != D &&
"Inst occurs in data structures");
1511 E = ReverseLocalDeps.
end();
I != E; ++
I) {
1512 assert(
I->first != D &&
"Inst occurs in data structures");
1514 EE =
I->second.end(); II != EE; ++II)
1515 assert(*II != D &&
"Inst occurs in data structures");
1519 E = ReverseNonLocalDeps.
end();
1521 assert(
I->first != D &&
"Inst occurs in data structures");
1523 EE =
I->second.end(); II != EE; ++II)
1524 assert(*II != D &&
"Inst occurs in data structures");
1528 I = ReverseNonLocalPtrDeps.
begin(),
1529 E = ReverseNonLocalPtrDeps.
end();
I != E; ++
I) {
1530 assert(
I->first != D &&
"Inst occurs in rev NLPD map");
1533 E =
I->second.end(); II != E; ++II)
1534 assert(*II != ValueIsLoadPair(D,
false) &&
1535 *II != ValueIsLoadPair(D,
true) &&
1536 "Inst occurs in ReverseNonLocalPtrDeps map");
void push_back(const T &Elt)
Pointers differ, but pointees overlap.
virtual bool pointsToConstantMemory(const Location &Loc, bool OrLocal=false)
static PassRegistry * getPassRegistry()
void invalidateCachedPointerInfo(Value *Ptr)
static const int BlockScanLimit
ModRefResult getModRefInfo(const Instruction *I, const Location &Loc)
bool isReachableFromEntry(const BasicBlock *A) const
static void RemoveFromReverseMap(DenseMap< Instruction *, SmallPtrSet< KeyTy, 4 > > &ReverseMap, Instruction *Inst, KeyTy Val)
An abstraction for memory operations.
enable_if_c<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
Value * GetPointerBaseWithConstantOffset(Value *Ptr, int64_t &Offset, const DataLayout *TD)
static void AssertSorted(MemoryDependenceAnalysis::NonLocalDepInfo &Cache, int Count=-1)
const Function * getParent() const
Return the enclosing method, or null if none.
~MemoryDependenceAnalysis()
LoopInfoBase< BlockT, LoopT > * LI
const CallInst * isFreeCall(const Value *I, const TargetLibraryInfo *TLI)
isFreeCall - Returns non-null if the value is a call to the builtin free()
Value * GetUnderlyingObject(Value *V, const DataLayout *TD=0, unsigned MaxLookup=6)
bool NeedsPHITranslationFromBlock(BasicBlock *BB) const
T LLVM_ATTRIBUTE_UNUSED_RESULT pop_back_val()
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
static MemDepResult getDef(Instruction *Inst)
ID
LLVM Calling Convention Representation.
static unsigned getLoadLoadClobberFullWidthSize(const Value *MemLocBase, int64_t MemLocOffs, unsigned MemLocSize, const LoadInst *LI, const DataLayout &TD)
void getNonLocalPointerDependency(const AliasAnalysis::Location &Loc, bool isLoad, BasicBlock *BB, SmallVectorImpl< NonLocalDepResult > &Result)
bool isNoAliasFn(const Value *V, const TargetLibraryInfo *TLI, bool LookThroughBitCast=false)
Tests if a value is a call or invoke to a function that returns a NoAlias pointer (including malloc/c...
bool mayReadFromMemory() const
bool runOnFunction(Function &)
Pass Implementation stuff. This doesn't do any analysis eagerly.
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
STATISTIC(NumCacheNonLocal,"Number of fully cached non-local responses")
bool onlyReadsMemory(ImmutableCallSite CS)
static MemDepResult getUnknown()
Location getWithNewSize(uint64_t NewSize) const
virtual void getAnalysisUsage(AnalysisUsage &AU) const
bool isIdenticalToWhenDefined(const Instruction *I) const
static AliasAnalysis::ModRefResult GetLocation(const Instruction *Inst, AliasAnalysis::Location &Loc, AliasAnalysis *AA)
LLVM Basic Block Representation.
bool PHITranslateValue(BasicBlock *CurBB, BasicBlock *PredBB, const DominatorTree *DT)
InstrTy * getInstruction() const
virtual AliasResult alias(const Location &LocA, const Location &LocB)
static MemDepResult getNonFuncLocal()
Value * getPointerOperand()
const MemDepResult & getResult() const
Integer representation type.
bool count(const KeyT &Val) const
count - Return true if the specified key is in the map.
void setResult(const MemDepResult &R)
Location - A description of a memory location.
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
#define INITIALIZE_AG_DEPENDENCY(depName)
void append(in_iter in_start, in_iter in_end)
MemDepResult getPointerDependencyFrom(const AliasAnalysis::Location &Loc, bool isLoad, BasicBlock::iterator ScanIt, BasicBlock *BB, Instruction *QueryInst=0)
uint64_t NextPowerOf2(uint64_t A)
virtual void deleteValue(Value *V)
bool IsPotentiallyPHITranslatable() const
bool mayWriteToMemory() const
bool isTerminator() const
bool isMustAlias(const Location &LocA, const Location &LocB)
isMustAlias - A convenience wrapper.
SmallPtrSetIterator - This implements a const_iterator for SmallPtrSet.
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
DenseMapIterator< KeyT, ValueT, KeyInfoT, true > const_iterator
PointerTy getPointer() const
bool fitsInLegalInteger(unsigned Width) const
static MemDepResult getClobber(Instruction *Inst)
MDNode * getMetadata(unsigned KindID) const
bool erase(const KeyT &Val)
std::vector< NonLocalDepEntry > NonLocalDepInfo
const BasicBlock & getEntryBlock() const
AttributeSet getAttributes() const
Return the attribute list for this Function.
bool isMallocLikeFn(const Value *V, const TargetLibraryInfo *TLI, bool LookThroughBitCast=false)
Tests if a value is a call or invoke to a library function that allocates uninitialized memory (such ...
Location getLocation(const LoadInst *LI)
INITIALIZE_PASS_BEGIN(MemoryDependenceAnalysis,"memdep","Memory Dependence Analysis", false, true) INITIALIZE_PASS_END(MemoryDependenceAnalysis
DenseMapIterator< KeyT, ValueT, KeyInfoT > iterator
void initializeMemoryDependenceAnalysisPass(PassRegistry &)
Instruction * getInst() const
static void SortNonLocalDepInfoCache(MemoryDependenceAnalysis::NonLocalDepInfo &Cache, unsigned NumSortedEntries)
MemDepResult getDependency(Instruction *QueryInst)
void invalidateCachedPredecessors()
unsigned getAlignment() const
std::reverse_iterator< const_iterator > reverse_iterator
bool isCallocLikeFn(const Value *V, const TargetLibraryInfo *TLI, bool LookThroughBitCast=false)
Tests if a value is a call or invoke to a library function that allocates zero-filled memory (such as...
const Value * Ptr
Ptr - The address of the start of the location.
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
const NonLocalDepInfo & getNonLocalCallDependency(CallSite QueryCS)
unsigned getPrimitiveSizeInBits() const
AnalysisUsage & addRequiredTransitive()
Memory Dependence Analysis
Location getWithNewPtr(const Value *NewPtr) const
LLVM Value Representation.
Location getWithoutTBAATag() const
ItTy prior(ItTy it, Dist n)
const TargetLibraryInfo * getTargetLibraryInfo() const
static bool isLoadLoadClobberIfExtendedToFullWidth(const AliasAnalysis::Location &MemLoc, const Value *&MemLocBase, int64_t &MemLocOffs, const LoadInst *LI, const DataLayout *TD)
ModRefResult callCapturesBefore(const Instruction *I, const AliasAnalysis::Location &MemLoc, DominatorTree *DT)
iterator find(const KeyT &Val)
static MemDepResult getNonLocal()
void releaseMemory()
Clean up memory in between runs.
const BasicBlock * getParent() const
INITIALIZE_PASS(GlobalMerge,"global-merge","Global Merge", false, false) bool GlobalMerge const DataLayout * TD
void removeInstruction(Instruction *InstToRemove)