Owen Anderson | 78e02f7 | 2007-07-06 23:14:35 +0000 | [diff] [blame] | 1 | //===- MemoryDependenceAnalysis.cpp - Mem Deps Implementation --*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Owen Anderson | 78e02f7 | 2007-07-06 23:14:35 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file implements an analysis that determines, for a given memory |
| 11 | // operation, what preceding memory operations it depends on. It builds on |
Owen Anderson | 80b1f09 | 2007-08-08 22:01:54 +0000 | [diff] [blame] | 12 | // alias analysis information, and tries to provide a lazy, caching interface to |
Owen Anderson | 78e02f7 | 2007-07-06 23:14:35 +0000 | [diff] [blame] | 13 | // a common kind of alias information query. |
| 14 | // |
| 15 | //===----------------------------------------------------------------------===// |
| 16 | |
Chris Lattner | 0e575f4 | 2008-11-28 21:45:17 +0000 | [diff] [blame] | 17 | #define DEBUG_TYPE "memdep" |
Owen Anderson | 78e02f7 | 2007-07-06 23:14:35 +0000 | [diff] [blame] | 18 | #include "llvm/Analysis/MemoryDependenceAnalysis.h" |
Owen Anderson | 7a616a1 | 2007-07-10 17:25:03 +0000 | [diff] [blame] | 19 | #include "llvm/Constants.h" |
Owen Anderson | 78e02f7 | 2007-07-06 23:14:35 +0000 | [diff] [blame] | 20 | #include "llvm/Instructions.h" |
| 21 | #include "llvm/Function.h" |
| 22 | #include "llvm/Analysis/AliasAnalysis.h" |
Chris Lattner | baad888 | 2008-11-28 22:28:27 +0000 | [diff] [blame] | 23 | #include "llvm/ADT/Statistic.h" |
Owen Anderson | 4beedbd | 2007-07-24 21:52:37 +0000 | [diff] [blame] | 24 | #include "llvm/Support/CFG.h" |
Chris Lattner | 0e575f4 | 2008-11-28 21:45:17 +0000 | [diff] [blame] | 25 | #include "llvm/Support/Debug.h" |
Owen Anderson | 78e02f7 | 2007-07-06 23:14:35 +0000 | [diff] [blame] | 26 | #include "llvm/Target/TargetData.h" |
Owen Anderson | 78e02f7 | 2007-07-06 23:14:35 +0000 | [diff] [blame] | 27 | using namespace llvm; |
| 28 | |
Chris Lattner | bf145d6 | 2008-12-01 01:15:42 +0000 | [diff] [blame] | 29 | STATISTIC(NumCacheNonLocal, "Number of fully cached non-local responses"); |
| 30 | STATISTIC(NumCacheDirtyNonLocal, "Number of dirty cached non-local responses"); |
Chris Lattner | 0ec48dd | 2008-11-29 22:02:15 +0000 | [diff] [blame] | 31 | STATISTIC(NumUncacheNonLocal, "Number of uncached non-local responses"); |
Chris Lattner | 6290f5c | 2008-12-07 08:50:20 +0000 | [diff] [blame^] | 32 | |
| 33 | STATISTIC(NumCacheNonLocalPtr, |
| 34 | "Number of fully cached non-local ptr responses"); |
| 35 | STATISTIC(NumCacheDirtyNonLocalPtr, |
| 36 | "Number of cached, but dirty, non-local ptr responses"); |
| 37 | STATISTIC(NumUncacheNonLocalPtr, |
| 38 | "Number of uncached non-local ptr responses"); |
| 39 | |
Owen Anderson | 78e02f7 | 2007-07-06 23:14:35 +0000 | [diff] [blame] | 40 | char MemoryDependenceAnalysis::ID = 0; |
| 41 | |
Owen Anderson | 78e02f7 | 2007-07-06 23:14:35 +0000 | [diff] [blame] | 42 | // Register this pass... |
Owen Anderson | 776ee1f | 2007-07-10 20:21:08 +0000 | [diff] [blame] | 43 | static RegisterPass<MemoryDependenceAnalysis> X("memdep", |
Chris Lattner | 0e575f4 | 2008-11-28 21:45:17 +0000 | [diff] [blame] | 44 | "Memory Dependence Analysis", false, true); |
Owen Anderson | 78e02f7 | 2007-07-06 23:14:35 +0000 | [diff] [blame] | 45 | |
| 46 | /// getAnalysisUsage - Does not modify anything. It uses Alias Analysis. |
| 47 | /// |
| 48 | void MemoryDependenceAnalysis::getAnalysisUsage(AnalysisUsage &AU) const { |
| 49 | AU.setPreservesAll(); |
| 50 | AU.addRequiredTransitive<AliasAnalysis>(); |
| 51 | AU.addRequiredTransitive<TargetData>(); |
| 52 | } |
| 53 | |
Chris Lattner | d777d40 | 2008-11-30 19:24:31 +0000 | [diff] [blame] | 54 | bool MemoryDependenceAnalysis::runOnFunction(Function &) { |
| 55 | AA = &getAnalysis<AliasAnalysis>(); |
| 56 | TD = &getAnalysis<TargetData>(); |
| 57 | return false; |
| 58 | } |
| 59 | |
Chris Lattner | bf145d6 | 2008-12-01 01:15:42 +0000 | [diff] [blame] | 60 | |
Chris Lattner | 8ef57c5 | 2008-12-07 00:35:51 +0000 | [diff] [blame] | 61 | /// getCallSiteDependencyFrom - Private helper for finding the local |
| 62 | /// dependencies of a call site. |
Chris Lattner | fd3dcbe | 2008-11-30 23:17:19 +0000 | [diff] [blame] | 63 | MemDepResult MemoryDependenceAnalysis:: |
Chris Lattner | 8ef57c5 | 2008-12-07 00:35:51 +0000 | [diff] [blame] | 64 | getCallSiteDependencyFrom(CallSite CS, BasicBlock::iterator ScanIt, |
| 65 | BasicBlock *BB) { |
Owen Anderson | 642a9e3 | 2007-08-08 22:26:03 +0000 | [diff] [blame] | 66 | // Walk backwards through the block, looking for dependencies |
Chris Lattner | 5391a1d | 2008-11-29 03:47:00 +0000 | [diff] [blame] | 67 | while (ScanIt != BB->begin()) { |
| 68 | Instruction *Inst = --ScanIt; |
Owen Anderson | 5f32320 | 2007-07-10 17:59:22 +0000 | [diff] [blame] | 69 | |
| 70 | // If this inst is a memory op, get the pointer it accessed |
Chris Lattner | 00314b3 | 2008-11-29 09:15:21 +0000 | [diff] [blame] | 71 | Value *Pointer = 0; |
| 72 | uint64_t PointerSize = 0; |
| 73 | if (StoreInst *S = dyn_cast<StoreInst>(Inst)) { |
| 74 | Pointer = S->getPointerOperand(); |
Chris Lattner | d777d40 | 2008-11-30 19:24:31 +0000 | [diff] [blame] | 75 | PointerSize = TD->getTypeStoreSize(S->getOperand(0)->getType()); |
Chris Lattner | 00314b3 | 2008-11-29 09:15:21 +0000 | [diff] [blame] | 76 | } else if (VAArgInst *V = dyn_cast<VAArgInst>(Inst)) { |
| 77 | Pointer = V->getOperand(0); |
Chris Lattner | d777d40 | 2008-11-30 19:24:31 +0000 | [diff] [blame] | 78 | PointerSize = TD->getTypeStoreSize(V->getType()); |
Chris Lattner | 00314b3 | 2008-11-29 09:15:21 +0000 | [diff] [blame] | 79 | } else if (FreeInst *F = dyn_cast<FreeInst>(Inst)) { |
| 80 | Pointer = F->getPointerOperand(); |
Owen Anderson | 5f32320 | 2007-07-10 17:59:22 +0000 | [diff] [blame] | 81 | |
| 82 | // FreeInsts erase the entire structure |
Chris Lattner | 6290f5c | 2008-12-07 08:50:20 +0000 | [diff] [blame^] | 83 | PointerSize = ~0ULL; |
Chris Lattner | 00314b3 | 2008-11-29 09:15:21 +0000 | [diff] [blame] | 84 | } else if (isa<CallInst>(Inst) || isa<InvokeInst>(Inst)) { |
Chris Lattner | b51deb9 | 2008-12-05 21:04:20 +0000 | [diff] [blame] | 85 | CallSite InstCS = CallSite::get(Inst); |
| 86 | // If these two calls do not interfere, look past it. |
| 87 | if (AA->getModRefInfo(CS, InstCS) == AliasAnalysis::NoModRef) |
Chris Lattner | 00314b3 | 2008-11-29 09:15:21 +0000 | [diff] [blame] | 88 | continue; |
Chris Lattner | b51deb9 | 2008-12-05 21:04:20 +0000 | [diff] [blame] | 89 | |
| 90 | // FIXME: If this is a ref/ref result, we should ignore it! |
| 91 | // X = strlen(P); |
| 92 | // Y = strlen(Q); |
| 93 | // Z = strlen(P); // Z = X |
| 94 | |
| 95 | // If they interfere, we generally return clobber. However, if they are |
| 96 | // calls to the same read-only functions we return Def. |
| 97 | if (!AA->onlyReadsMemory(CS) || CS.getCalledFunction() == 0 || |
| 98 | CS.getCalledFunction() != InstCS.getCalledFunction()) |
| 99 | return MemDepResult::getClobber(Inst); |
| 100 | return MemDepResult::getDef(Inst); |
Chris Lattner | cfbb634 | 2008-11-30 01:44:00 +0000 | [diff] [blame] | 101 | } else { |
| 102 | // Non-memory instruction. |
Owen Anderson | 202da14 | 2007-07-10 20:39:07 +0000 | [diff] [blame] | 103 | continue; |
Chris Lattner | cfbb634 | 2008-11-30 01:44:00 +0000 | [diff] [blame] | 104 | } |
Owen Anderson | 5f32320 | 2007-07-10 17:59:22 +0000 | [diff] [blame] | 105 | |
Chris Lattner | b51deb9 | 2008-12-05 21:04:20 +0000 | [diff] [blame] | 106 | if (AA->getModRefInfo(CS, Pointer, PointerSize) != AliasAnalysis::NoModRef) |
| 107 | return MemDepResult::getClobber(Inst); |
Owen Anderson | 5f32320 | 2007-07-10 17:59:22 +0000 | [diff] [blame] | 108 | } |
| 109 | |
Chris Lattner | 7ebcf03 | 2008-12-07 02:15:47 +0000 | [diff] [blame] | 110 | // No dependence found. If this is the entry block of the function, it is a |
| 111 | // clobber, otherwise it is non-local. |
| 112 | if (BB != &BB->getParent()->getEntryBlock()) |
| 113 | return MemDepResult::getNonLocal(); |
| 114 | return MemDepResult::getClobber(ScanIt); |
Owen Anderson | 5f32320 | 2007-07-10 17:59:22 +0000 | [diff] [blame] | 115 | } |
| 116 | |
Chris Lattner | e79be94 | 2008-12-07 01:50:16 +0000 | [diff] [blame] | 117 | /// getPointerDependencyFrom - Return the instruction on which a memory |
| 118 | /// location depends. If isLoad is true, this routine ignore may-aliases with |
| 119 | /// read-only operations. |
Chris Lattner | fd3dcbe | 2008-11-30 23:17:19 +0000 | [diff] [blame] | 120 | MemDepResult MemoryDependenceAnalysis:: |
Chris Lattner | e79be94 | 2008-12-07 01:50:16 +0000 | [diff] [blame] | 121 | getPointerDependencyFrom(Value *MemPtr, uint64_t MemSize, bool isLoad, |
| 122 | BasicBlock::iterator ScanIt, BasicBlock *BB) { |
Chris Lattner | 7ebcf03 | 2008-12-07 02:15:47 +0000 | [diff] [blame] | 123 | |
Chris Lattner | 6290f5c | 2008-12-07 08:50:20 +0000 | [diff] [blame^] | 124 | // Walk backwards through the basic block, looking for dependencies. |
Chris Lattner | 5391a1d | 2008-11-29 03:47:00 +0000 | [diff] [blame] | 125 | while (ScanIt != BB->begin()) { |
| 126 | Instruction *Inst = --ScanIt; |
Chris Lattner | a161ab0 | 2008-11-29 09:09:48 +0000 | [diff] [blame] | 127 | |
Chris Lattner | cfbb634 | 2008-11-30 01:44:00 +0000 | [diff] [blame] | 128 | // Values depend on loads if the pointers are must aliased. This means that |
| 129 | // a load depends on another must aliased load from the same value. |
Chris Lattner | b51deb9 | 2008-12-05 21:04:20 +0000 | [diff] [blame] | 130 | if (LoadInst *LI = dyn_cast<LoadInst>(Inst)) { |
Chris Lattner | b51deb9 | 2008-12-05 21:04:20 +0000 | [diff] [blame] | 131 | Value *Pointer = LI->getPointerOperand(); |
| 132 | uint64_t PointerSize = TD->getTypeStoreSize(LI->getType()); |
| 133 | |
| 134 | // If we found a pointer, check if it could be the same as our pointer. |
Chris Lattner | a161ab0 | 2008-11-29 09:09:48 +0000 | [diff] [blame] | 135 | AliasAnalysis::AliasResult R = |
Chris Lattner | d777d40 | 2008-11-30 19:24:31 +0000 | [diff] [blame] | 136 | AA->alias(Pointer, PointerSize, MemPtr, MemSize); |
Chris Lattner | a161ab0 | 2008-11-29 09:09:48 +0000 | [diff] [blame] | 137 | if (R == AliasAnalysis::NoAlias) |
| 138 | continue; |
| 139 | |
| 140 | // May-alias loads don't depend on each other without a dependence. |
Chris Lattner | e79be94 | 2008-12-07 01:50:16 +0000 | [diff] [blame] | 141 | if (isLoad && R == AliasAnalysis::MayAlias) |
Chris Lattner | a161ab0 | 2008-11-29 09:09:48 +0000 | [diff] [blame] | 142 | continue; |
Chris Lattner | 6290f5c | 2008-12-07 08:50:20 +0000 | [diff] [blame^] | 143 | // Stores depend on may and must aliased loads, loads depend on must-alias |
| 144 | // loads. |
Chris Lattner | b51deb9 | 2008-12-05 21:04:20 +0000 | [diff] [blame] | 145 | return MemDepResult::getDef(Inst); |
| 146 | } |
| 147 | |
| 148 | if (StoreInst *SI = dyn_cast<StoreInst>(Inst)) { |
Chris Lattner | b51deb9 | 2008-12-05 21:04:20 +0000 | [diff] [blame] | 149 | Value *Pointer = SI->getPointerOperand(); |
| 150 | uint64_t PointerSize = TD->getTypeStoreSize(SI->getOperand(0)->getType()); |
| 151 | |
| 152 | // If we found a pointer, check if it could be the same as our pointer. |
| 153 | AliasAnalysis::AliasResult R = |
| 154 | AA->alias(Pointer, PointerSize, MemPtr, MemSize); |
| 155 | |
| 156 | if (R == AliasAnalysis::NoAlias) |
| 157 | continue; |
| 158 | if (R == AliasAnalysis::MayAlias) |
| 159 | return MemDepResult::getClobber(Inst); |
| 160 | return MemDepResult::getDef(Inst); |
Owen Anderson | 78e02f7 | 2007-07-06 23:14:35 +0000 | [diff] [blame] | 161 | } |
Chris Lattner | 237a828 | 2008-11-30 01:39:32 +0000 | [diff] [blame] | 162 | |
| 163 | // If this is an allocation, and if we know that the accessed pointer is to |
Chris Lattner | b51deb9 | 2008-12-05 21:04:20 +0000 | [diff] [blame] | 164 | // the allocation, return Def. This means that there is no dependence and |
Chris Lattner | 237a828 | 2008-11-30 01:39:32 +0000 | [diff] [blame] | 165 | // the access can be optimized based on that. For example, a load could |
| 166 | // turn into undef. |
Chris Lattner | a161ab0 | 2008-11-29 09:09:48 +0000 | [diff] [blame] | 167 | if (AllocationInst *AI = dyn_cast<AllocationInst>(Inst)) { |
Chris Lattner | 237a828 | 2008-11-30 01:39:32 +0000 | [diff] [blame] | 168 | Value *AccessPtr = MemPtr->getUnderlyingObject(); |
Owen Anderson | 78e02f7 | 2007-07-06 23:14:35 +0000 | [diff] [blame] | 169 | |
Chris Lattner | 237a828 | 2008-11-30 01:39:32 +0000 | [diff] [blame] | 170 | if (AccessPtr == AI || |
Chris Lattner | d777d40 | 2008-11-30 19:24:31 +0000 | [diff] [blame] | 171 | AA->alias(AI, 1, AccessPtr, 1) == AliasAnalysis::MustAlias) |
Chris Lattner | b51deb9 | 2008-12-05 21:04:20 +0000 | [diff] [blame] | 172 | return MemDepResult::getDef(AI); |
Chris Lattner | 237a828 | 2008-11-30 01:39:32 +0000 | [diff] [blame] | 173 | continue; |
Chris Lattner | a161ab0 | 2008-11-29 09:09:48 +0000 | [diff] [blame] | 174 | } |
Chris Lattner | a161ab0 | 2008-11-29 09:09:48 +0000 | [diff] [blame] | 175 | |
Chris Lattner | b51deb9 | 2008-12-05 21:04:20 +0000 | [diff] [blame] | 176 | // See if this instruction (e.g. a call or vaarg) mod/ref's the pointer. |
Chris Lattner | e79be94 | 2008-12-07 01:50:16 +0000 | [diff] [blame] | 177 | // FIXME: If this is a load, we should ignore readonly calls! |
Chris Lattner | b51deb9 | 2008-12-05 21:04:20 +0000 | [diff] [blame] | 178 | if (AA->getModRefInfo(Inst, MemPtr, MemSize) == AliasAnalysis::NoModRef) |
Chris Lattner | 25a0814 | 2008-11-29 08:51:16 +0000 | [diff] [blame] | 179 | continue; |
Chris Lattner | a161ab0 | 2008-11-29 09:09:48 +0000 | [diff] [blame] | 180 | |
| 181 | // Otherwise, there is a dependence. |
Chris Lattner | b51deb9 | 2008-12-05 21:04:20 +0000 | [diff] [blame] | 182 | return MemDepResult::getClobber(Inst); |
Owen Anderson | 78e02f7 | 2007-07-06 23:14:35 +0000 | [diff] [blame] | 183 | } |
| 184 | |
Chris Lattner | 7ebcf03 | 2008-12-07 02:15:47 +0000 | [diff] [blame] | 185 | // No dependence found. If this is the entry block of the function, it is a |
| 186 | // clobber, otherwise it is non-local. |
| 187 | if (BB != &BB->getParent()->getEntryBlock()) |
| 188 | return MemDepResult::getNonLocal(); |
| 189 | return MemDepResult::getClobber(ScanIt); |
Owen Anderson | 78e02f7 | 2007-07-06 23:14:35 +0000 | [diff] [blame] | 190 | } |
| 191 | |
Chris Lattner | 5391a1d | 2008-11-29 03:47:00 +0000 | [diff] [blame] | 192 | /// getDependency - Return the instruction on which a memory operation |
| 193 | /// depends. |
| 194 | MemDepResult MemoryDependenceAnalysis::getDependency(Instruction *QueryInst) { |
| 195 | Instruction *ScanPos = QueryInst; |
| 196 | |
| 197 | // Check for a cached result |
Chris Lattner | fd3dcbe | 2008-11-30 23:17:19 +0000 | [diff] [blame] | 198 | MemDepResult &LocalCache = LocalDeps[QueryInst]; |
Chris Lattner | 5391a1d | 2008-11-29 03:47:00 +0000 | [diff] [blame] | 199 | |
Chris Lattner | 0ec48dd | 2008-11-29 22:02:15 +0000 | [diff] [blame] | 200 | // If the cached entry is non-dirty, just return it. Note that this depends |
Chris Lattner | fd3dcbe | 2008-11-30 23:17:19 +0000 | [diff] [blame] | 201 | // on MemDepResult's default constructing to 'dirty'. |
| 202 | if (!LocalCache.isDirty()) |
| 203 | return LocalCache; |
Chris Lattner | 5391a1d | 2008-11-29 03:47:00 +0000 | [diff] [blame] | 204 | |
| 205 | // Otherwise, if we have a dirty entry, we know we can start the scan at that |
| 206 | // instruction, which may save us some work. |
Chris Lattner | fd3dcbe | 2008-11-30 23:17:19 +0000 | [diff] [blame] | 207 | if (Instruction *Inst = LocalCache.getInst()) { |
Chris Lattner | 5391a1d | 2008-11-29 03:47:00 +0000 | [diff] [blame] | 208 | ScanPos = Inst; |
Chris Lattner | 4a69bad | 2008-11-30 02:52:26 +0000 | [diff] [blame] | 209 | |
| 210 | SmallPtrSet<Instruction*, 4> &InstMap = ReverseLocalDeps[Inst]; |
Chris Lattner | 6290f5c | 2008-12-07 08:50:20 +0000 | [diff] [blame^] | 211 | bool Found = InstMap.erase(QueryInst); |
| 212 | assert(Found && "Invalid reverse map!"); Found=Found; |
Chris Lattner | 4a69bad | 2008-11-30 02:52:26 +0000 | [diff] [blame] | 213 | if (InstMap.empty()) |
Chris Lattner | 6290f5c | 2008-12-07 08:50:20 +0000 | [diff] [blame^] | 214 | // FIXME: use an iterator to avoid looking up inst again. |
Chris Lattner | 4a69bad | 2008-11-30 02:52:26 +0000 | [diff] [blame] | 215 | ReverseLocalDeps.erase(Inst); |
| 216 | } |
Chris Lattner | 5391a1d | 2008-11-29 03:47:00 +0000 | [diff] [blame] | 217 | |
Chris Lattner | e79be94 | 2008-12-07 01:50:16 +0000 | [diff] [blame] | 218 | BasicBlock *QueryParent = QueryInst->getParent(); |
| 219 | |
| 220 | Value *MemPtr = 0; |
| 221 | uint64_t MemSize = 0; |
| 222 | |
Chris Lattner | 5391a1d | 2008-11-29 03:47:00 +0000 | [diff] [blame] | 223 | // Do the scan. |
Chris Lattner | e79be94 | 2008-12-07 01:50:16 +0000 | [diff] [blame] | 224 | if (BasicBlock::iterator(QueryInst) == QueryParent->begin()) { |
Chris Lattner | 7ebcf03 | 2008-12-07 02:15:47 +0000 | [diff] [blame] | 225 | // No dependence found. If this is the entry block of the function, it is a |
| 226 | // clobber, otherwise it is non-local. |
| 227 | if (QueryParent != &QueryParent->getParent()->getEntryBlock()) |
| 228 | LocalCache = MemDepResult::getNonLocal(); |
| 229 | else |
| 230 | LocalCache = MemDepResult::getClobber(QueryInst); |
Chris Lattner | e79be94 | 2008-12-07 01:50:16 +0000 | [diff] [blame] | 231 | } else if (StoreInst *SI = dyn_cast<StoreInst>(QueryInst)) { |
| 232 | // If this is a volatile store, don't mess around with it. Just return the |
| 233 | // previous instruction as a clobber. |
| 234 | if (SI->isVolatile()) |
| 235 | LocalCache = MemDepResult::getClobber(--BasicBlock::iterator(ScanPos)); |
| 236 | else { |
| 237 | MemPtr = SI->getPointerOperand(); |
| 238 | MemSize = TD->getTypeStoreSize(SI->getOperand(0)->getType()); |
| 239 | } |
| 240 | } else if (LoadInst *LI = dyn_cast<LoadInst>(QueryInst)) { |
| 241 | // If this is a volatile load, don't mess around with it. Just return the |
| 242 | // previous instruction as a clobber. |
| 243 | if (LI->isVolatile()) |
| 244 | LocalCache = MemDepResult::getClobber(--BasicBlock::iterator(ScanPos)); |
| 245 | else { |
| 246 | MemPtr = LI->getPointerOperand(); |
| 247 | MemSize = TD->getTypeStoreSize(LI->getType()); |
| 248 | } |
| 249 | } else if (isa<CallInst>(QueryInst) || isa<InvokeInst>(QueryInst)) { |
Chris Lattner | d8dd934 | 2008-12-07 01:21:14 +0000 | [diff] [blame] | 250 | LocalCache = getCallSiteDependencyFrom(CallSite::get(QueryInst), ScanPos, |
Chris Lattner | e79be94 | 2008-12-07 01:50:16 +0000 | [diff] [blame] | 251 | QueryParent); |
| 252 | } else if (FreeInst *FI = dyn_cast<FreeInst>(QueryInst)) { |
| 253 | MemPtr = FI->getPointerOperand(); |
| 254 | // FreeInsts erase the entire structure, not just a field. |
| 255 | MemSize = ~0UL; |
| 256 | } else { |
| 257 | // Non-memory instruction. |
| 258 | LocalCache = MemDepResult::getClobber(--BasicBlock::iterator(ScanPos)); |
| 259 | } |
| 260 | |
| 261 | // If we need to do a pointer scan, make it happen. |
| 262 | if (MemPtr) |
| 263 | LocalCache = getPointerDependencyFrom(MemPtr, MemSize, |
| 264 | isa<LoadInst>(QueryInst), |
| 265 | ScanPos, QueryParent); |
Chris Lattner | 5391a1d | 2008-11-29 03:47:00 +0000 | [diff] [blame] | 266 | |
| 267 | // Remember the result! |
Chris Lattner | fd3dcbe | 2008-11-30 23:17:19 +0000 | [diff] [blame] | 268 | if (Instruction *I = LocalCache.getInst()) |
Chris Lattner | 8c46527 | 2008-11-29 09:20:15 +0000 | [diff] [blame] | 269 | ReverseLocalDeps[I].insert(QueryInst); |
Chris Lattner | 5391a1d | 2008-11-29 03:47:00 +0000 | [diff] [blame] | 270 | |
Chris Lattner | fd3dcbe | 2008-11-30 23:17:19 +0000 | [diff] [blame] | 271 | return LocalCache; |
Chris Lattner | 5391a1d | 2008-11-29 03:47:00 +0000 | [diff] [blame] | 272 | } |
| 273 | |
Chris Lattner | 37d041c | 2008-11-30 01:18:27 +0000 | [diff] [blame] | 274 | /// getNonLocalDependency - Perform a full dependency query for the |
| 275 | /// specified instruction, returning the set of blocks that the value is |
| 276 | /// potentially live across. The returned set of results will include a |
| 277 | /// "NonLocal" result for all blocks where the value is live across. |
| 278 | /// |
| 279 | /// This method assumes the instruction returns a "nonlocal" dependency |
| 280 | /// within its own block. |
| 281 | /// |
Chris Lattner | bf145d6 | 2008-12-01 01:15:42 +0000 | [diff] [blame] | 282 | const MemoryDependenceAnalysis::NonLocalDepInfo & |
| 283 | MemoryDependenceAnalysis::getNonLocalDependency(Instruction *QueryInst) { |
Chris Lattner | 7ebcf03 | 2008-12-07 02:15:47 +0000 | [diff] [blame] | 284 | // FIXME: Make this only be for callsites in the future. |
Chris Lattner | e79be94 | 2008-12-07 01:50:16 +0000 | [diff] [blame] | 285 | assert(isa<CallInst>(QueryInst) || isa<InvokeInst>(QueryInst) || |
| 286 | isa<LoadInst>(QueryInst) || isa<StoreInst>(QueryInst)); |
Chris Lattner | 37d041c | 2008-11-30 01:18:27 +0000 | [diff] [blame] | 287 | assert(getDependency(QueryInst).isNonLocal() && |
| 288 | "getNonLocalDependency should only be used on insts with non-local deps!"); |
Chris Lattner | 4a69bad | 2008-11-30 02:52:26 +0000 | [diff] [blame] | 289 | PerInstNLInfo &CacheP = NonLocalDeps[QueryInst]; |
Chris Lattner | bf145d6 | 2008-12-01 01:15:42 +0000 | [diff] [blame] | 290 | NonLocalDepInfo &Cache = CacheP.first; |
Chris Lattner | 37d041c | 2008-11-30 01:18:27 +0000 | [diff] [blame] | 291 | |
| 292 | /// DirtyBlocks - This is the set of blocks that need to be recomputed. In |
| 293 | /// the cached case, this can happen due to instructions being deleted etc. In |
| 294 | /// the uncached case, this starts out as the set of predecessors we care |
| 295 | /// about. |
| 296 | SmallVector<BasicBlock*, 32> DirtyBlocks; |
| 297 | |
| 298 | if (!Cache.empty()) { |
Chris Lattner | bf145d6 | 2008-12-01 01:15:42 +0000 | [diff] [blame] | 299 | // Okay, we have a cache entry. If we know it is not dirty, just return it |
| 300 | // with no computation. |
| 301 | if (!CacheP.second) { |
| 302 | NumCacheNonLocal++; |
| 303 | return Cache; |
| 304 | } |
| 305 | |
Chris Lattner | 37d041c | 2008-11-30 01:18:27 +0000 | [diff] [blame] | 306 | // If we already have a partially computed set of results, scan them to |
Chris Lattner | bf145d6 | 2008-12-01 01:15:42 +0000 | [diff] [blame] | 307 | // determine what is dirty, seeding our initial DirtyBlocks worklist. |
| 308 | for (NonLocalDepInfo::iterator I = Cache.begin(), E = Cache.end(); |
| 309 | I != E; ++I) |
| 310 | if (I->second.isDirty()) |
| 311 | DirtyBlocks.push_back(I->first); |
Chris Lattner | 37d041c | 2008-11-30 01:18:27 +0000 | [diff] [blame] | 312 | |
Chris Lattner | bf145d6 | 2008-12-01 01:15:42 +0000 | [diff] [blame] | 313 | // Sort the cache so that we can do fast binary search lookups below. |
| 314 | std::sort(Cache.begin(), Cache.end()); |
Chris Lattner | 37d041c | 2008-11-30 01:18:27 +0000 | [diff] [blame] | 315 | |
Chris Lattner | bf145d6 | 2008-12-01 01:15:42 +0000 | [diff] [blame] | 316 | ++NumCacheDirtyNonLocal; |
Chris Lattner | 37d041c | 2008-11-30 01:18:27 +0000 | [diff] [blame] | 317 | //cerr << "CACHED CASE: " << DirtyBlocks.size() << " dirty: " |
| 318 | // << Cache.size() << " cached: " << *QueryInst; |
| 319 | } else { |
| 320 | // Seed DirtyBlocks with each of the preds of QueryInst's block. |
| 321 | BasicBlock *QueryBB = QueryInst->getParent(); |
| 322 | DirtyBlocks.append(pred_begin(QueryBB), pred_end(QueryBB)); |
| 323 | NumUncacheNonLocal++; |
| 324 | } |
| 325 | |
Chris Lattner | bf145d6 | 2008-12-01 01:15:42 +0000 | [diff] [blame] | 326 | // Visited checked first, vector in sorted order. |
| 327 | SmallPtrSet<BasicBlock*, 64> Visited; |
| 328 | |
| 329 | unsigned NumSortedEntries = Cache.size(); |
| 330 | |
Chris Lattner | 37d041c | 2008-11-30 01:18:27 +0000 | [diff] [blame] | 331 | // Iterate while we still have blocks to update. |
| 332 | while (!DirtyBlocks.empty()) { |
| 333 | BasicBlock *DirtyBB = DirtyBlocks.back(); |
| 334 | DirtyBlocks.pop_back(); |
| 335 | |
Chris Lattner | bf145d6 | 2008-12-01 01:15:42 +0000 | [diff] [blame] | 336 | // Already processed this block? |
| 337 | if (!Visited.insert(DirtyBB)) |
| 338 | continue; |
Chris Lattner | 37d041c | 2008-11-30 01:18:27 +0000 | [diff] [blame] | 339 | |
Chris Lattner | bf145d6 | 2008-12-01 01:15:42 +0000 | [diff] [blame] | 340 | // Do a binary search to see if we already have an entry for this block in |
| 341 | // the cache set. If so, find it. |
| 342 | NonLocalDepInfo::iterator Entry = |
| 343 | std::upper_bound(Cache.begin(), Cache.begin()+NumSortedEntries, |
| 344 | std::make_pair(DirtyBB, MemDepResult())); |
| 345 | if (Entry != Cache.begin() && (&*Entry)[-1].first == DirtyBB) |
| 346 | --Entry; |
| 347 | |
| 348 | MemDepResult *ExistingResult = 0; |
| 349 | if (Entry != Cache.begin()+NumSortedEntries && |
| 350 | Entry->first == DirtyBB) { |
| 351 | // If we already have an entry, and if it isn't already dirty, the block |
| 352 | // is done. |
| 353 | if (!Entry->second.isDirty()) |
| 354 | continue; |
| 355 | |
| 356 | // Otherwise, remember this slot so we can update the value. |
| 357 | ExistingResult = &Entry->second; |
| 358 | } |
| 359 | |
Chris Lattner | 37d041c | 2008-11-30 01:18:27 +0000 | [diff] [blame] | 360 | // If the dirty entry has a pointer, start scanning from it so we don't have |
| 361 | // to rescan the entire block. |
| 362 | BasicBlock::iterator ScanPos = DirtyBB->end(); |
Chris Lattner | bf145d6 | 2008-12-01 01:15:42 +0000 | [diff] [blame] | 363 | if (ExistingResult) { |
| 364 | if (Instruction *Inst = ExistingResult->getInst()) { |
| 365 | ScanPos = Inst; |
Chris Lattner | f68f310 | 2008-11-30 02:28:25 +0000 | [diff] [blame] | 366 | |
Chris Lattner | bf145d6 | 2008-12-01 01:15:42 +0000 | [diff] [blame] | 367 | // We're removing QueryInst's use of Inst. |
| 368 | SmallPtrSet<Instruction*, 4> &InstMap = ReverseNonLocalDeps[Inst]; |
Chris Lattner | 6290f5c | 2008-12-07 08:50:20 +0000 | [diff] [blame^] | 369 | bool Found = InstMap.erase(QueryInst); |
| 370 | assert(Found && "Invalid reverse map!"); Found=Found; |
| 371 | // FIXME: Use an iterator to avoid looking up inst again. |
Chris Lattner | bf145d6 | 2008-12-01 01:15:42 +0000 | [diff] [blame] | 372 | if (InstMap.empty()) ReverseNonLocalDeps.erase(Inst); |
| 373 | } |
Chris Lattner | f68f310 | 2008-11-30 02:28:25 +0000 | [diff] [blame] | 374 | } |
Chris Lattner | 37d041c | 2008-11-30 01:18:27 +0000 | [diff] [blame] | 375 | |
Chris Lattner | 73ec3cd | 2008-11-30 01:26:32 +0000 | [diff] [blame] | 376 | // Find out if this block has a local dependency for QueryInst. |
Chris Lattner | d8dd934 | 2008-12-07 01:21:14 +0000 | [diff] [blame] | 377 | MemDepResult Dep; |
Chris Lattner | e79be94 | 2008-12-07 01:50:16 +0000 | [diff] [blame] | 378 | |
| 379 | Value *MemPtr = 0; |
| 380 | uint64_t MemSize = 0; |
| 381 | |
Chris Lattner | 7ebcf03 | 2008-12-07 02:15:47 +0000 | [diff] [blame] | 382 | if (ScanPos == DirtyBB->begin()) { |
| 383 | // No dependence found. If this is the entry block of the function, it is a |
| 384 | // clobber, otherwise it is non-local. |
| 385 | if (DirtyBB != &DirtyBB->getParent()->getEntryBlock()) |
| 386 | Dep = MemDepResult::getNonLocal(); |
| 387 | else |
| 388 | Dep = MemDepResult::getClobber(ScanPos); |
Chris Lattner | e79be94 | 2008-12-07 01:50:16 +0000 | [diff] [blame] | 389 | } else if (StoreInst *SI = dyn_cast<StoreInst>(QueryInst)) { |
| 390 | // If this is a volatile store, don't mess around with it. Just return the |
| 391 | // previous instruction as a clobber. |
| 392 | if (SI->isVolatile()) |
| 393 | Dep = MemDepResult::getClobber(--BasicBlock::iterator(ScanPos)); |
| 394 | else { |
| 395 | MemPtr = SI->getPointerOperand(); |
| 396 | MemSize = TD->getTypeStoreSize(SI->getOperand(0)->getType()); |
| 397 | } |
| 398 | } else if (LoadInst *LI = dyn_cast<LoadInst>(QueryInst)) { |
| 399 | // If this is a volatile load, don't mess around with it. Just return the |
| 400 | // previous instruction as a clobber. |
| 401 | if (LI->isVolatile()) |
| 402 | Dep = MemDepResult::getClobber(--BasicBlock::iterator(ScanPos)); |
| 403 | else { |
| 404 | MemPtr = LI->getPointerOperand(); |
| 405 | MemSize = TD->getTypeStoreSize(LI->getType()); |
| 406 | } |
| 407 | } else { |
| 408 | assert(isa<CallInst>(QueryInst) || isa<InvokeInst>(QueryInst)); |
Chris Lattner | d8dd934 | 2008-12-07 01:21:14 +0000 | [diff] [blame] | 409 | Dep = getCallSiteDependencyFrom(CallSite::get(QueryInst), ScanPos, |
| 410 | DirtyBB); |
Chris Lattner | e79be94 | 2008-12-07 01:50:16 +0000 | [diff] [blame] | 411 | } |
| 412 | |
| 413 | if (MemPtr) |
| 414 | Dep = getPointerDependencyFrom(MemPtr, MemSize, isa<LoadInst>(QueryInst), |
| 415 | ScanPos, DirtyBB); |
Chris Lattner | bf145d6 | 2008-12-01 01:15:42 +0000 | [diff] [blame] | 416 | |
| 417 | // If we had a dirty entry for the block, update it. Otherwise, just add |
| 418 | // a new entry. |
| 419 | if (ExistingResult) |
| 420 | *ExistingResult = Dep; |
| 421 | else |
| 422 | Cache.push_back(std::make_pair(DirtyBB, Dep)); |
| 423 | |
Chris Lattner | 37d041c | 2008-11-30 01:18:27 +0000 | [diff] [blame] | 424 | // If the block has a dependency (i.e. it isn't completely transparent to |
Chris Lattner | bf145d6 | 2008-12-01 01:15:42 +0000 | [diff] [blame] | 425 | // the value), remember the association! |
| 426 | if (!Dep.isNonLocal()) { |
Chris Lattner | 37d041c | 2008-11-30 01:18:27 +0000 | [diff] [blame] | 427 | // Keep the ReverseNonLocalDeps map up to date so we can efficiently |
| 428 | // update this when we remove instructions. |
Chris Lattner | bf145d6 | 2008-12-01 01:15:42 +0000 | [diff] [blame] | 429 | if (Instruction *Inst = Dep.getInst()) |
Chris Lattner | 37d041c | 2008-11-30 01:18:27 +0000 | [diff] [blame] | 430 | ReverseNonLocalDeps[Inst].insert(QueryInst); |
Chris Lattner | bf145d6 | 2008-12-01 01:15:42 +0000 | [diff] [blame] | 431 | } else { |
Chris Lattner | 37d041c | 2008-11-30 01:18:27 +0000 | [diff] [blame] | 432 | |
Chris Lattner | bf145d6 | 2008-12-01 01:15:42 +0000 | [diff] [blame] | 433 | // If the block *is* completely transparent to the load, we need to check |
| 434 | // the predecessors of this block. Add them to our worklist. |
| 435 | DirtyBlocks.append(pred_begin(DirtyBB), pred_end(DirtyBB)); |
| 436 | } |
Chris Lattner | 37d041c | 2008-11-30 01:18:27 +0000 | [diff] [blame] | 437 | } |
| 438 | |
Chris Lattner | bf145d6 | 2008-12-01 01:15:42 +0000 | [diff] [blame] | 439 | return Cache; |
Chris Lattner | 37d041c | 2008-11-30 01:18:27 +0000 | [diff] [blame] | 440 | } |
| 441 | |
Chris Lattner | 7ebcf03 | 2008-12-07 02:15:47 +0000 | [diff] [blame] | 442 | /// getNonLocalPointerDependency - Perform a full dependency query for an |
| 443 | /// access to the specified (non-volatile) memory location, returning the |
| 444 | /// set of instructions that either define or clobber the value. |
| 445 | /// |
| 446 | /// This method assumes the pointer has a "NonLocal" dependency within its |
| 447 | /// own block. |
| 448 | /// |
| 449 | void MemoryDependenceAnalysis:: |
| 450 | getNonLocalPointerDependency(Value *Pointer, bool isLoad, BasicBlock *FromBB, |
| 451 | SmallVectorImpl<NonLocalDepEntry> &Result) { |
Chris Lattner | 9a193fd | 2008-12-07 02:56:57 +0000 | [diff] [blame] | 452 | Result.clear(); |
| 453 | |
Chris Lattner | 7ebcf03 | 2008-12-07 02:15:47 +0000 | [diff] [blame] | 454 | // We know that the pointer value is live into FromBB find the def/clobbers |
| 455 | // from presecessors. |
Chris Lattner | 7ebcf03 | 2008-12-07 02:15:47 +0000 | [diff] [blame] | 456 | const Type *EltTy = cast<PointerType>(Pointer->getType())->getElementType(); |
| 457 | uint64_t PointeeSize = TD->getTypeStoreSize(EltTy); |
| 458 | |
| 459 | // While we have blocks to analyze, get their values. |
| 460 | SmallPtrSet<BasicBlock*, 64> Visited; |
Chris Lattner | 9a193fd | 2008-12-07 02:56:57 +0000 | [diff] [blame] | 461 | |
| 462 | for (pred_iterator PI = pred_begin(FromBB), E = pred_end(FromBB); PI != E; |
| 463 | ++PI) { |
| 464 | // TODO: PHI TRANSLATE. |
| 465 | getNonLocalPointerDepInternal(Pointer, PointeeSize, isLoad, *PI, |
| 466 | Result, Visited); |
| 467 | } |
| 468 | } |
| 469 | |
| 470 | void MemoryDependenceAnalysis:: |
| 471 | getNonLocalPointerDepInternal(Value *Pointer, uint64_t PointeeSize, |
| 472 | bool isLoad, BasicBlock *StartBB, |
| 473 | SmallVectorImpl<NonLocalDepEntry> &Result, |
| 474 | SmallPtrSet<BasicBlock*, 64> &Visited) { |
| 475 | SmallVector<BasicBlock*, 32> Worklist; |
| 476 | Worklist.push_back(StartBB); |
| 477 | |
Chris Lattner | 6290f5c | 2008-12-07 08:50:20 +0000 | [diff] [blame^] | 478 | // Look up the cached info for Pointer. |
| 479 | ValueIsLoadPair CacheKey(Pointer, isLoad); |
| 480 | NonLocalDepInfo *Cache = &NonLocalPointerDeps[CacheKey]; |
| 481 | |
| 482 | // Keep track of the entries that we know are sorted. Previously cached |
| 483 | // entries will all be sorted. The entries we add we only sort on demand (we |
| 484 | // don't insert every element into its sorted position). We know that we |
| 485 | // won't get any reuse from currently inserted values, because we don't |
| 486 | // revisit blocks after we insert info for them. |
| 487 | unsigned NumSortedEntries = Cache->size(); |
| 488 | |
Chris Lattner | 7ebcf03 | 2008-12-07 02:15:47 +0000 | [diff] [blame] | 489 | while (!Worklist.empty()) { |
Chris Lattner | 9a193fd | 2008-12-07 02:56:57 +0000 | [diff] [blame] | 490 | BasicBlock *BB = Worklist.pop_back_val(); |
Chris Lattner | 7ebcf03 | 2008-12-07 02:15:47 +0000 | [diff] [blame] | 491 | |
| 492 | // Analyze the dependency of *Pointer in FromBB. See if we already have |
| 493 | // been here. |
Chris Lattner | 9a193fd | 2008-12-07 02:56:57 +0000 | [diff] [blame] | 494 | if (!Visited.insert(BB)) |
Chris Lattner | 7ebcf03 | 2008-12-07 02:15:47 +0000 | [diff] [blame] | 495 | continue; |
Chris Lattner | 6290f5c | 2008-12-07 08:50:20 +0000 | [diff] [blame^] | 496 | |
| 497 | // Get the dependency info for Pointer in BB. If we have cached |
| 498 | // information, we will use it, otherwise we compute it. |
Chris Lattner | 7ebcf03 | 2008-12-07 02:15:47 +0000 | [diff] [blame] | 499 | |
Chris Lattner | 6290f5c | 2008-12-07 08:50:20 +0000 | [diff] [blame^] | 500 | // Do a binary search to see if we already have an entry for this block in |
| 501 | // the cache set. If so, find it. |
| 502 | NonLocalDepInfo::iterator Entry = |
| 503 | std::upper_bound(Cache->begin(), Cache->begin()+NumSortedEntries, |
| 504 | std::make_pair(BB, MemDepResult())); |
| 505 | if (Entry != Cache->begin() && (&*Entry)[-1].first == BB) |
| 506 | --Entry; |
Chris Lattner | 7ebcf03 | 2008-12-07 02:15:47 +0000 | [diff] [blame] | 507 | |
Chris Lattner | 6290f5c | 2008-12-07 08:50:20 +0000 | [diff] [blame^] | 508 | MemDepResult *ExistingResult = 0; |
| 509 | if (Entry != Cache->begin()+NumSortedEntries && Entry->first == BB) |
| 510 | ExistingResult = &Entry->second; |
| 511 | |
| 512 | // If we have a cached entry, and it is non-dirty, use it as the value for |
| 513 | // this dependency. |
| 514 | MemDepResult Dep; |
| 515 | if (ExistingResult && !ExistingResult->isDirty()) { |
| 516 | Dep = *ExistingResult; |
| 517 | ++NumCacheNonLocalPtr; |
| 518 | } else { |
| 519 | // Otherwise, we have to scan for the value. If we have a dirty cache |
| 520 | // entry, start scanning from its position, otherwise we scan from the end |
| 521 | // of the block. |
| 522 | BasicBlock::iterator ScanPos = BB->end(); |
| 523 | if (ExistingResult && ExistingResult->getInst()) { |
| 524 | assert(ExistingResult->getInst()->getParent() == BB && |
| 525 | "Instruction invalidated?"); |
| 526 | ++NumCacheDirtyNonLocalPtr; |
| 527 | ScanPos = ExistingResult->getInst(); |
| 528 | |
| 529 | // Eliminating the dirty entry from 'Cache', so update the reverse info. |
| 530 | SmallPtrSet<void *, 4> &InstMap = ReverseNonLocalPtrDeps[ScanPos]; |
| 531 | bool Contained = InstMap.erase(CacheKey.getOpaqueValue()); |
| 532 | assert(Contained && "Invalid cache entry"); Contained=Contained; |
| 533 | // FIXME: Use an iterator to avoid a repeated lookup in ".erase". |
| 534 | if (InstMap.empty()) ReverseNonLocalPtrDeps.erase(ScanPos); |
| 535 | } else { |
| 536 | ++NumUncacheNonLocalPtr; |
| 537 | } |
| 538 | |
| 539 | // Scan the block for the dependency. |
| 540 | Dep = getPointerDependencyFrom(Pointer, PointeeSize, isLoad, ScanPos, BB); |
| 541 | |
| 542 | // If we had a dirty entry for the block, update it. Otherwise, just add |
| 543 | // a new entry. |
| 544 | if (ExistingResult) |
| 545 | *ExistingResult = Dep; |
| 546 | else |
| 547 | Cache->push_back(std::make_pair(BB, Dep)); |
| 548 | |
| 549 | // If the block has a dependency (i.e. it isn't completely transparent to |
| 550 | // the value), remember the reverse association because we just added it |
| 551 | // to Cache! |
| 552 | if (!Dep.isNonLocal()) { |
| 553 | // Keep the ReverseNonLocalPtrDeps map up to date so we can efficiently |
| 554 | // update MemDep when we remove instructions. |
| 555 | Instruction *Inst = Dep.getInst(); |
| 556 | assert(Inst && "Didn't depend on anything?"); |
| 557 | ReverseNonLocalPtrDeps[Inst].insert(CacheKey.getOpaqueValue()); |
| 558 | } |
| 559 | } |
Chris Lattner | 7ebcf03 | 2008-12-07 02:15:47 +0000 | [diff] [blame] | 560 | |
| 561 | // If we got a Def or Clobber, add this to the list of results. |
| 562 | if (!Dep.isNonLocal()) { |
Chris Lattner | 9a193fd | 2008-12-07 02:56:57 +0000 | [diff] [blame] | 563 | Result.push_back(NonLocalDepEntry(BB, Dep)); |
Chris Lattner | 7ebcf03 | 2008-12-07 02:15:47 +0000 | [diff] [blame] | 564 | continue; |
| 565 | } |
| 566 | |
| 567 | // Otherwise, we have to process all the predecessors of this block to scan |
| 568 | // them as well. |
Chris Lattner | 9a193fd | 2008-12-07 02:56:57 +0000 | [diff] [blame] | 569 | for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI) { |
Chris Lattner | 7ebcf03 | 2008-12-07 02:15:47 +0000 | [diff] [blame] | 570 | // TODO: PHI TRANSLATE. |
Chris Lattner | 9a193fd | 2008-12-07 02:56:57 +0000 | [diff] [blame] | 571 | Worklist.push_back(*PI); |
| 572 | } |
Chris Lattner | 7ebcf03 | 2008-12-07 02:15:47 +0000 | [diff] [blame] | 573 | } |
Chris Lattner | 6290f5c | 2008-12-07 08:50:20 +0000 | [diff] [blame^] | 574 | |
| 575 | // If we computed new values, re-sort Cache. |
| 576 | if (NumSortedEntries != Cache->size()) |
| 577 | std::sort(Cache->begin(), Cache->end()); |
| 578 | } |
| 579 | |
| 580 | /// RemoveCachedNonLocalPointerDependencies - If P exists in |
| 581 | /// CachedNonLocalPointerInfo, remove it. |
| 582 | void MemoryDependenceAnalysis:: |
| 583 | RemoveCachedNonLocalPointerDependencies(ValueIsLoadPair P) { |
| 584 | CachedNonLocalPointerInfo::iterator It = |
| 585 | NonLocalPointerDeps.find(P); |
| 586 | if (It == NonLocalPointerDeps.end()) return; |
| 587 | |
| 588 | // Remove all of the entries in the BB->val map. This involves removing |
| 589 | // instructions from the reverse map. |
| 590 | NonLocalDepInfo &PInfo = It->second; |
| 591 | |
| 592 | for (unsigned i = 0, e = PInfo.size(); i != e; ++i) { |
| 593 | Instruction *Target = PInfo[i].second.getInst(); |
| 594 | if (Target == 0) continue; // Ignore non-local dep results. |
| 595 | assert(Target->getParent() == PInfo[i].first && Target != P.getPointer()); |
| 596 | |
| 597 | // Eliminating the dirty entry from 'Cache', so update the reverse info. |
| 598 | SmallPtrSet<void *, 4> &InstMap = ReverseNonLocalPtrDeps[Target]; |
| 599 | bool Contained = InstMap.erase(P.getOpaqueValue()); |
| 600 | assert(Contained && "Invalid cache entry"); Contained=Contained; |
| 601 | |
| 602 | // FIXME: Use an iterator to avoid a repeated lookup in ".erase". |
| 603 | if (InstMap.empty()) ReverseNonLocalPtrDeps.erase(Target); |
| 604 | } |
| 605 | |
| 606 | // Remove P from NonLocalPointerDeps (which deletes NonLocalDepInfo). |
| 607 | NonLocalPointerDeps.erase(It); |
Chris Lattner | 7ebcf03 | 2008-12-07 02:15:47 +0000 | [diff] [blame] | 608 | } |
| 609 | |
| 610 | |
Owen Anderson | 78e02f7 | 2007-07-06 23:14:35 +0000 | [diff] [blame] | 611 | /// removeInstruction - Remove an instruction from the dependence analysis, |
| 612 | /// updating the dependence of instructions that previously depended on it. |
Owen Anderson | 642a9e3 | 2007-08-08 22:26:03 +0000 | [diff] [blame] | 613 | /// This method attempts to keep the cache coherent using the reverse map. |
Chris Lattner | 5f589dc | 2008-11-28 22:04:47 +0000 | [diff] [blame] | 614 | void MemoryDependenceAnalysis::removeInstruction(Instruction *RemInst) { |
Chris Lattner | 5f589dc | 2008-11-28 22:04:47 +0000 | [diff] [blame] | 615 | // Walk through the Non-local dependencies, removing this one as the value |
| 616 | // for any cached queries. |
Chris Lattner | f68f310 | 2008-11-30 02:28:25 +0000 | [diff] [blame] | 617 | NonLocalDepMapType::iterator NLDI = NonLocalDeps.find(RemInst); |
| 618 | if (NLDI != NonLocalDeps.end()) { |
Chris Lattner | bf145d6 | 2008-12-01 01:15:42 +0000 | [diff] [blame] | 619 | NonLocalDepInfo &BlockMap = NLDI->second.first; |
Chris Lattner | 25f4b2b | 2008-11-30 02:30:50 +0000 | [diff] [blame] | 620 | for (NonLocalDepInfo::iterator DI = BlockMap.begin(), DE = BlockMap.end(); |
| 621 | DI != DE; ++DI) |
Chris Lattner | fd3dcbe | 2008-11-30 23:17:19 +0000 | [diff] [blame] | 622 | if (Instruction *Inst = DI->second.getInst()) |
Chris Lattner | f68f310 | 2008-11-30 02:28:25 +0000 | [diff] [blame] | 623 | ReverseNonLocalDeps[Inst].erase(RemInst); |
Chris Lattner | f68f310 | 2008-11-30 02:28:25 +0000 | [diff] [blame] | 624 | NonLocalDeps.erase(NLDI); |
| 625 | } |
Owen Anderson | 5fc4aba | 2007-12-08 01:37:09 +0000 | [diff] [blame] | 626 | |
Chris Lattner | 5f589dc | 2008-11-28 22:04:47 +0000 | [diff] [blame] | 627 | // If we have a cached local dependence query for this instruction, remove it. |
Chris Lattner | baad888 | 2008-11-28 22:28:27 +0000 | [diff] [blame] | 628 | // |
Chris Lattner | 39f372e | 2008-11-29 01:43:36 +0000 | [diff] [blame] | 629 | LocalDepMapType::iterator LocalDepEntry = LocalDeps.find(RemInst); |
| 630 | if (LocalDepEntry != LocalDeps.end()) { |
Chris Lattner | 125ce36 | 2008-11-30 01:09:30 +0000 | [diff] [blame] | 631 | // Remove us from DepInst's reverse set now that the local dep info is gone. |
Chris Lattner | fd3dcbe | 2008-11-30 23:17:19 +0000 | [diff] [blame] | 632 | if (Instruction *Inst = LocalDepEntry->second.getInst()) { |
Chris Lattner | 125ce36 | 2008-11-30 01:09:30 +0000 | [diff] [blame] | 633 | SmallPtrSet<Instruction*, 4> &RLD = ReverseLocalDeps[Inst]; |
Chris Lattner | 6290f5c | 2008-12-07 08:50:20 +0000 | [diff] [blame^] | 634 | bool Found = RLD.erase(RemInst); |
| 635 | assert(Found && "Invalid reverse map!"); Found=Found; |
| 636 | // FIXME: Use an iterator to avoid looking up Inst again. |
Chris Lattner | 125ce36 | 2008-11-30 01:09:30 +0000 | [diff] [blame] | 637 | if (RLD.empty()) |
| 638 | ReverseLocalDeps.erase(Inst); |
| 639 | } |
| 640 | |
Chris Lattner | baad888 | 2008-11-28 22:28:27 +0000 | [diff] [blame] | 641 | // Remove this local dependency info. |
Chris Lattner | 39f372e | 2008-11-29 01:43:36 +0000 | [diff] [blame] | 642 | LocalDeps.erase(LocalDepEntry); |
Chris Lattner | 6290f5c | 2008-12-07 08:50:20 +0000 | [diff] [blame^] | 643 | } |
| 644 | |
| 645 | // If we have any cached pointer dependencies on this instruction, remove |
| 646 | // them. If the instruction has non-pointer type, then it can't be a pointer |
| 647 | // base. |
| 648 | |
| 649 | // Remove it from both the load info and the store info. The instruction |
| 650 | // can't be in either of these maps if it is non-pointer. |
| 651 | if (isa<PointerType>(RemInst->getType())) { |
| 652 | RemoveCachedNonLocalPointerDependencies(ValueIsLoadPair(RemInst, false)); |
| 653 | RemoveCachedNonLocalPointerDependencies(ValueIsLoadPair(RemInst, true)); |
| 654 | } |
Chris Lattner | baad888 | 2008-11-28 22:28:27 +0000 | [diff] [blame] | 655 | |
Chris Lattner | d3d12ec | 2008-11-28 22:51:08 +0000 | [diff] [blame] | 656 | // Loop over all of the things that depend on the instruction we're removing. |
| 657 | // |
Chris Lattner | 4f8c18c | 2008-11-29 23:30:39 +0000 | [diff] [blame] | 658 | SmallVector<std::pair<Instruction*, Instruction*>, 8> ReverseDepsToAdd; |
| 659 | |
Chris Lattner | 8c46527 | 2008-11-29 09:20:15 +0000 | [diff] [blame] | 660 | ReverseDepMapType::iterator ReverseDepIt = ReverseLocalDeps.find(RemInst); |
| 661 | if (ReverseDepIt != ReverseLocalDeps.end()) { |
Chris Lattner | d3d12ec | 2008-11-28 22:51:08 +0000 | [diff] [blame] | 662 | SmallPtrSet<Instruction*, 4> &ReverseDeps = ReverseDepIt->second; |
Chris Lattner | 6290f5c | 2008-12-07 08:50:20 +0000 | [diff] [blame^] | 663 | // RemInst can't be the terminator if it has local stuff depending on it. |
Chris Lattner | 125ce36 | 2008-11-30 01:09:30 +0000 | [diff] [blame] | 664 | assert(!ReverseDeps.empty() && !isa<TerminatorInst>(RemInst) && |
| 665 | "Nothing can locally depend on a terminator"); |
| 666 | |
| 667 | // Anything that was locally dependent on RemInst is now going to be |
| 668 | // dependent on the instruction after RemInst. It will have the dirty flag |
| 669 | // set so it will rescan. This saves having to scan the entire block to get |
| 670 | // to this point. |
Chris Lattner | 6290f5c | 2008-12-07 08:50:20 +0000 | [diff] [blame^] | 671 | Instruction *NewDepInst = ++BasicBlock::iterator(RemInst); |
Chris Lattner | 125ce36 | 2008-11-30 01:09:30 +0000 | [diff] [blame] | 672 | |
Chris Lattner | d3d12ec | 2008-11-28 22:51:08 +0000 | [diff] [blame] | 673 | for (SmallPtrSet<Instruction*, 4>::iterator I = ReverseDeps.begin(), |
| 674 | E = ReverseDeps.end(); I != E; ++I) { |
| 675 | Instruction *InstDependingOnRemInst = *I; |
Chris Lattner | f68f310 | 2008-11-30 02:28:25 +0000 | [diff] [blame] | 676 | assert(InstDependingOnRemInst != RemInst && |
| 677 | "Already removed our local dep info"); |
Chris Lattner | 125ce36 | 2008-11-30 01:09:30 +0000 | [diff] [blame] | 678 | |
Chris Lattner | fd3dcbe | 2008-11-30 23:17:19 +0000 | [diff] [blame] | 679 | LocalDeps[InstDependingOnRemInst] = MemDepResult::getDirty(NewDepInst); |
Chris Lattner | d3d12ec | 2008-11-28 22:51:08 +0000 | [diff] [blame] | 680 | |
Chris Lattner | 125ce36 | 2008-11-30 01:09:30 +0000 | [diff] [blame] | 681 | // Make sure to remember that new things depend on NewDepInst. |
| 682 | ReverseDepsToAdd.push_back(std::make_pair(NewDepInst, |
| 683 | InstDependingOnRemInst)); |
Chris Lattner | d3d12ec | 2008-11-28 22:51:08 +0000 | [diff] [blame] | 684 | } |
Chris Lattner | 4f8c18c | 2008-11-29 23:30:39 +0000 | [diff] [blame] | 685 | |
| 686 | ReverseLocalDeps.erase(ReverseDepIt); |
| 687 | |
| 688 | // Add new reverse deps after scanning the set, to avoid invalidating the |
| 689 | // 'ReverseDeps' reference. |
| 690 | while (!ReverseDepsToAdd.empty()) { |
| 691 | ReverseLocalDeps[ReverseDepsToAdd.back().first] |
| 692 | .insert(ReverseDepsToAdd.back().second); |
| 693 | ReverseDepsToAdd.pop_back(); |
| 694 | } |
Owen Anderson | 78e02f7 | 2007-07-06 23:14:35 +0000 | [diff] [blame] | 695 | } |
Owen Anderson | 4d13de4 | 2007-08-16 21:27:05 +0000 | [diff] [blame] | 696 | |
Chris Lattner | 8c46527 | 2008-11-29 09:20:15 +0000 | [diff] [blame] | 697 | ReverseDepIt = ReverseNonLocalDeps.find(RemInst); |
| 698 | if (ReverseDepIt != ReverseNonLocalDeps.end()) { |
Chris Lattner | 6290f5c | 2008-12-07 08:50:20 +0000 | [diff] [blame^] | 699 | SmallPtrSet<Instruction*, 4> &Set = ReverseDepIt->second; |
| 700 | for (SmallPtrSet<Instruction*, 4>::iterator I = Set.begin(), E = Set.end(); |
Chris Lattner | f68f310 | 2008-11-30 02:28:25 +0000 | [diff] [blame] | 701 | I != E; ++I) { |
| 702 | assert(*I != RemInst && "Already removed NonLocalDep info for RemInst"); |
| 703 | |
Chris Lattner | 4a69bad | 2008-11-30 02:52:26 +0000 | [diff] [blame] | 704 | PerInstNLInfo &INLD = NonLocalDeps[*I]; |
Chris Lattner | 4a69bad | 2008-11-30 02:52:26 +0000 | [diff] [blame] | 705 | // The information is now dirty! |
Chris Lattner | bf145d6 | 2008-12-01 01:15:42 +0000 | [diff] [blame] | 706 | INLD.second = true; |
Chris Lattner | f68f310 | 2008-11-30 02:28:25 +0000 | [diff] [blame] | 707 | |
Chris Lattner | bf145d6 | 2008-12-01 01:15:42 +0000 | [diff] [blame] | 708 | for (NonLocalDepInfo::iterator DI = INLD.first.begin(), |
| 709 | DE = INLD.first.end(); DI != DE; ++DI) { |
Chris Lattner | fd3dcbe | 2008-11-30 23:17:19 +0000 | [diff] [blame] | 710 | if (DI->second.getInst() != RemInst) continue; |
Chris Lattner | f68f310 | 2008-11-30 02:28:25 +0000 | [diff] [blame] | 711 | |
| 712 | // Convert to a dirty entry for the subsequent instruction. |
Chris Lattner | fd3dcbe | 2008-11-30 23:17:19 +0000 | [diff] [blame] | 713 | Instruction *NextI = 0; |
| 714 | if (!RemInst->isTerminator()) { |
Chris Lattner | 6290f5c | 2008-12-07 08:50:20 +0000 | [diff] [blame^] | 715 | NextI = ++BasicBlock::iterator(RemInst); |
Chris Lattner | f68f310 | 2008-11-30 02:28:25 +0000 | [diff] [blame] | 716 | ReverseDepsToAdd.push_back(std::make_pair(NextI, *I)); |
Chris Lattner | 0ec48dd | 2008-11-29 22:02:15 +0000 | [diff] [blame] | 717 | } |
Chris Lattner | fd3dcbe | 2008-11-30 23:17:19 +0000 | [diff] [blame] | 718 | DI->second = MemDepResult::getDirty(NextI); |
Chris Lattner | f68f310 | 2008-11-30 02:28:25 +0000 | [diff] [blame] | 719 | } |
| 720 | } |
Chris Lattner | 4f8c18c | 2008-11-29 23:30:39 +0000 | [diff] [blame] | 721 | |
| 722 | ReverseNonLocalDeps.erase(ReverseDepIt); |
| 723 | |
Chris Lattner | 0ec48dd | 2008-11-29 22:02:15 +0000 | [diff] [blame] | 724 | // Add new reverse deps after scanning the set, to avoid invalidating 'Set' |
| 725 | while (!ReverseDepsToAdd.empty()) { |
| 726 | ReverseNonLocalDeps[ReverseDepsToAdd.back().first] |
| 727 | .insert(ReverseDepsToAdd.back().second); |
| 728 | ReverseDepsToAdd.pop_back(); |
| 729 | } |
Owen Anderson | 4d13de4 | 2007-08-16 21:27:05 +0000 | [diff] [blame] | 730 | } |
Owen Anderson | 5fc4aba | 2007-12-08 01:37:09 +0000 | [diff] [blame] | 731 | |
Chris Lattner | 6290f5c | 2008-12-07 08:50:20 +0000 | [diff] [blame^] | 732 | // If the instruction is in ReverseNonLocalPtrDeps then it appears as a |
| 733 | // value in the NonLocalPointerDeps info. |
| 734 | ReverseNonLocalPtrDepTy::iterator ReversePtrDepIt = |
| 735 | ReverseNonLocalPtrDeps.find(RemInst); |
| 736 | if (ReversePtrDepIt != ReverseNonLocalPtrDeps.end()) { |
| 737 | SmallPtrSet<void*, 4> &Set = ReversePtrDepIt->second; |
| 738 | SmallVector<std::pair<Instruction*, ValueIsLoadPair>,8> ReversePtrDepsToAdd; |
| 739 | |
| 740 | for (SmallPtrSet<void*, 4>::iterator I = Set.begin(), E = Set.end(); |
| 741 | I != E; ++I) { |
| 742 | ValueIsLoadPair P; |
| 743 | P.setFromOpaqueValue(*I); |
| 744 | assert(P.getPointer() != RemInst && |
| 745 | "Already removed NonLocalPointerDeps info for RemInst"); |
| 746 | |
| 747 | NonLocalDepInfo &NLPDI = NonLocalPointerDeps[P]; |
| 748 | |
| 749 | MemDepResult NewDirtyVal; |
| 750 | if (!RemInst->isTerminator()) |
| 751 | NewDirtyVal = MemDepResult::getDirty(++BasicBlock::iterator(RemInst)); |
| 752 | |
| 753 | // Update any entries for RemInst to use the instruction after it. |
| 754 | for (NonLocalDepInfo::iterator DI = NLPDI.begin(), DE = NLPDI.end(); |
| 755 | DI != DE; ++DI) { |
| 756 | if (DI->second.getInst() != RemInst) continue; |
| 757 | |
| 758 | // Convert to a dirty entry for the subsequent instruction. |
| 759 | DI->second = NewDirtyVal; |
| 760 | |
| 761 | if (Instruction *NewDirtyInst = NewDirtyVal.getInst()) |
| 762 | ReversePtrDepsToAdd.push_back(std::make_pair(NewDirtyInst, P)); |
| 763 | } |
| 764 | } |
| 765 | |
| 766 | ReverseNonLocalPtrDeps.erase(ReversePtrDepIt); |
| 767 | |
| 768 | while (!ReversePtrDepsToAdd.empty()) { |
| 769 | ReverseNonLocalPtrDeps[ReversePtrDepsToAdd.back().first] |
| 770 | .insert(ReversePtrDepsToAdd.back().second.getOpaqueValue()); |
| 771 | ReversePtrDepsToAdd.pop_back(); |
| 772 | } |
| 773 | } |
| 774 | |
| 775 | |
Chris Lattner | f68f310 | 2008-11-30 02:28:25 +0000 | [diff] [blame] | 776 | assert(!NonLocalDeps.count(RemInst) && "RemInst got reinserted?"); |
Chris Lattner | d777d40 | 2008-11-30 19:24:31 +0000 | [diff] [blame] | 777 | AA->deleteValue(RemInst); |
Chris Lattner | 5f589dc | 2008-11-28 22:04:47 +0000 | [diff] [blame] | 778 | DEBUG(verifyRemoved(RemInst)); |
Owen Anderson | 78e02f7 | 2007-07-06 23:14:35 +0000 | [diff] [blame] | 779 | } |
Chris Lattner | 729b237 | 2008-11-29 21:25:10 +0000 | [diff] [blame] | 780 | |
| 781 | /// verifyRemoved - Verify that the specified instruction does not occur |
| 782 | /// in our internal data structures. |
| 783 | void MemoryDependenceAnalysis::verifyRemoved(Instruction *D) const { |
| 784 | for (LocalDepMapType::const_iterator I = LocalDeps.begin(), |
| 785 | E = LocalDeps.end(); I != E; ++I) { |
| 786 | assert(I->first != D && "Inst occurs in data structures"); |
Chris Lattner | fd3dcbe | 2008-11-30 23:17:19 +0000 | [diff] [blame] | 787 | assert(I->second.getInst() != D && |
Chris Lattner | 729b237 | 2008-11-29 21:25:10 +0000 | [diff] [blame] | 788 | "Inst occurs in data structures"); |
| 789 | } |
| 790 | |
Chris Lattner | 6290f5c | 2008-12-07 08:50:20 +0000 | [diff] [blame^] | 791 | for (CachedNonLocalPointerInfo::const_iterator I =NonLocalPointerDeps.begin(), |
| 792 | E = NonLocalPointerDeps.end(); I != E; ++I) { |
| 793 | assert(I->first.getPointer() != D && "Inst occurs in NLPD map key"); |
| 794 | const NonLocalDepInfo &Val = I->second; |
| 795 | for (NonLocalDepInfo::const_iterator II = Val.begin(), E = Val.end(); |
| 796 | II != E; ++II) |
| 797 | assert(II->second.getInst() != D && "Inst occurs as NLPD value"); |
| 798 | } |
| 799 | |
Chris Lattner | 729b237 | 2008-11-29 21:25:10 +0000 | [diff] [blame] | 800 | for (NonLocalDepMapType::const_iterator I = NonLocalDeps.begin(), |
| 801 | E = NonLocalDeps.end(); I != E; ++I) { |
| 802 | assert(I->first != D && "Inst occurs in data structures"); |
Chris Lattner | 4a69bad | 2008-11-30 02:52:26 +0000 | [diff] [blame] | 803 | const PerInstNLInfo &INLD = I->second; |
Chris Lattner | bf145d6 | 2008-12-01 01:15:42 +0000 | [diff] [blame] | 804 | for (NonLocalDepInfo::const_iterator II = INLD.first.begin(), |
| 805 | EE = INLD.first.end(); II != EE; ++II) |
Chris Lattner | fd3dcbe | 2008-11-30 23:17:19 +0000 | [diff] [blame] | 806 | assert(II->second.getInst() != D && "Inst occurs in data structures"); |
Chris Lattner | 729b237 | 2008-11-29 21:25:10 +0000 | [diff] [blame] | 807 | } |
| 808 | |
| 809 | for (ReverseDepMapType::const_iterator I = ReverseLocalDeps.begin(), |
Chris Lattner | f68f310 | 2008-11-30 02:28:25 +0000 | [diff] [blame] | 810 | E = ReverseLocalDeps.end(); I != E; ++I) { |
| 811 | assert(I->first != D && "Inst occurs in data structures"); |
Chris Lattner | 729b237 | 2008-11-29 21:25:10 +0000 | [diff] [blame] | 812 | for (SmallPtrSet<Instruction*, 4>::const_iterator II = I->second.begin(), |
| 813 | EE = I->second.end(); II != EE; ++II) |
| 814 | assert(*II != D && "Inst occurs in data structures"); |
Chris Lattner | f68f310 | 2008-11-30 02:28:25 +0000 | [diff] [blame] | 815 | } |
Chris Lattner | 729b237 | 2008-11-29 21:25:10 +0000 | [diff] [blame] | 816 | |
| 817 | for (ReverseDepMapType::const_iterator I = ReverseNonLocalDeps.begin(), |
| 818 | E = ReverseNonLocalDeps.end(); |
Chris Lattner | f68f310 | 2008-11-30 02:28:25 +0000 | [diff] [blame] | 819 | I != E; ++I) { |
| 820 | assert(I->first != D && "Inst occurs in data structures"); |
Chris Lattner | 729b237 | 2008-11-29 21:25:10 +0000 | [diff] [blame] | 821 | for (SmallPtrSet<Instruction*, 4>::const_iterator II = I->second.begin(), |
| 822 | EE = I->second.end(); II != EE; ++II) |
| 823 | assert(*II != D && "Inst occurs in data structures"); |
Chris Lattner | f68f310 | 2008-11-30 02:28:25 +0000 | [diff] [blame] | 824 | } |
Chris Lattner | 6290f5c | 2008-12-07 08:50:20 +0000 | [diff] [blame^] | 825 | |
| 826 | for (ReverseNonLocalPtrDepTy::const_iterator |
| 827 | I = ReverseNonLocalPtrDeps.begin(), |
| 828 | E = ReverseNonLocalPtrDeps.end(); I != E; ++I) { |
| 829 | assert(I->first != D && "Inst occurs in rev NLPD map"); |
| 830 | |
| 831 | for (SmallPtrSet<void*, 4>::const_iterator II = I->second.begin(), |
| 832 | E = I->second.end(); II != E; ++II) |
| 833 | assert(*II != ValueIsLoadPair(D, false).getOpaqueValue() && |
| 834 | *II != ValueIsLoadPair(D, true).getOpaqueValue() && |
| 835 | "Inst occurs in ReverseNonLocalPtrDeps map"); |
| 836 | } |
| 837 | |
Chris Lattner | 729b237 | 2008-11-29 21:25:10 +0000 | [diff] [blame] | 838 | } |