Chris Lattner | 9d7c9ea | 2003-11-25 20:11:47 +0000 | [diff] [blame] | 1 | //===- BasicAliasAnalysis.cpp - Local Alias Analysis Impl -----------------===// |
Misha Brukman | 2b37d7c | 2005-04-21 21:13:18 +0000 | [diff] [blame] | 2 | // |
John Criswell | b576c94 | 2003-10-20 19:43:21 +0000 | [diff] [blame] | 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. |
Misha Brukman | 2b37d7c | 2005-04-21 21:13:18 +0000 | [diff] [blame] | 7 | // |
John Criswell | b576c94 | 2003-10-20 19:43:21 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
Chris Lattner | d501c13 | 2003-02-26 19:41:54 +0000 | [diff] [blame] | 9 | // |
| 10 | // This file defines the default implementation of the Alias Analysis interface |
| 11 | // that simply implements a few identities (two different globals cannot alias, |
| 12 | // etc), but otherwise does no analysis. |
| 13 | // |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
| 16 | #include "llvm/Analysis/AliasAnalysis.h" |
Jeff Cohen | 534927d | 2005-01-08 22:01:16 +0000 | [diff] [blame] | 17 | #include "llvm/Analysis/Passes.h" |
Chris Lattner | 4244bb5 | 2004-03-15 03:36:49 +0000 | [diff] [blame] | 18 | #include "llvm/Constants.h" |
| 19 | #include "llvm/DerivedTypes.h" |
| 20 | #include "llvm/Function.h" |
Chris Lattner | 23e2a5b | 2009-11-26 02:14:59 +0000 | [diff] [blame] | 21 | #include "llvm/GlobalAlias.h" |
Chris Lattner | 4244bb5 | 2004-03-15 03:36:49 +0000 | [diff] [blame] | 22 | #include "llvm/GlobalVariable.h" |
Alkis Evlogimenos | eb62bc7 | 2004-07-29 12:17:34 +0000 | [diff] [blame] | 23 | #include "llvm/Instructions.h" |
Owen Anderson | 9b636cb | 2008-02-17 21:29:08 +0000 | [diff] [blame] | 24 | #include "llvm/IntrinsicInst.h" |
Dan Gohman | 3a7a68c | 2009-07-17 22:25:10 +0000 | [diff] [blame] | 25 | #include "llvm/Operator.h" |
Chris Lattner | 4244bb5 | 2004-03-15 03:36:49 +0000 | [diff] [blame] | 26 | #include "llvm/Pass.h" |
Chris Lattner | 5d5261c | 2009-11-26 16:26:43 +0000 | [diff] [blame] | 27 | #include "llvm/Analysis/CaptureTracking.h" |
| 28 | #include "llvm/Analysis/MemoryBuiltins.h" |
| 29 | #include "llvm/Analysis/ValueTracking.h" |
Chris Lattner | d501c13 | 2003-02-26 19:41:54 +0000 | [diff] [blame] | 30 | #include "llvm/Target/TargetData.h" |
Evan Cheng | 50a5914 | 2009-10-13 22:02:20 +0000 | [diff] [blame] | 31 | #include "llvm/ADT/SmallSet.h" |
Chris Lattner | a77600e | 2007-02-10 22:15:31 +0000 | [diff] [blame] | 32 | #include "llvm/ADT/SmallVector.h" |
Owen Anderson | 718cb66 | 2007-09-07 04:06:50 +0000 | [diff] [blame] | 33 | #include "llvm/ADT/STLExtras.h" |
Torok Edwin | c25e758 | 2009-07-11 20:10:48 +0000 | [diff] [blame] | 34 | #include "llvm/Support/ErrorHandling.h" |
Chris Lattner | 90aa839 | 2006-10-04 21:52:35 +0000 | [diff] [blame] | 35 | #include "llvm/Support/GetElementPtrTypeIterator.h" |
Alkis Evlogimenos | 20aa474 | 2004-09-03 18:19:51 +0000 | [diff] [blame] | 36 | #include <algorithm> |
Chris Lattner | ec4e808 | 2003-11-25 18:33:40 +0000 | [diff] [blame] | 37 | using namespace llvm; |
Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 38 | |
Chris Lattner | defa1c8 | 2008-06-16 06:30:22 +0000 | [diff] [blame] | 39 | //===----------------------------------------------------------------------===// |
| 40 | // Useful predicates |
| 41 | //===----------------------------------------------------------------------===// |
Devang Patel | 794fd75 | 2007-05-01 21:15:47 +0000 | [diff] [blame] | 42 | |
Chris Lattner | a413960 | 2008-06-16 06:10:11 +0000 | [diff] [blame] | 43 | /// isKnownNonNull - Return true if we know that the specified value is never |
| 44 | /// null. |
| 45 | static bool isKnownNonNull(const Value *V) { |
| 46 | // Alloca never returns null, malloc might. |
| 47 | if (isa<AllocaInst>(V)) return true; |
| 48 | |
| 49 | // A byval argument is never null. |
| 50 | if (const Argument *A = dyn_cast<Argument>(V)) |
| 51 | return A->hasByValAttr(); |
| 52 | |
| 53 | // Global values are not null unless extern weak. |
| 54 | if (const GlobalValue *GV = dyn_cast<GlobalValue>(V)) |
| 55 | return !GV->hasExternalWeakLinkage(); |
| 56 | return false; |
| 57 | } |
| 58 | |
Chris Lattner | 845f0d2 | 2008-06-16 06:19:11 +0000 | [diff] [blame] | 59 | /// isNonEscapingLocalObject - Return true if the pointer is to a function-local |
| 60 | /// object that never escapes from the function. |
| 61 | static bool isNonEscapingLocalObject(const Value *V) { |
Chris Lattner | e727579 | 2008-06-16 06:28:01 +0000 | [diff] [blame] | 62 | // If this is a local allocation, check to see if it escapes. |
Victor Hernandez | 7b929da | 2009-10-23 21:09:37 +0000 | [diff] [blame] | 63 | if (isa<AllocaInst>(V) || isNoAliasCall(V)) |
Dan Gohman | f94b5ed | 2009-11-19 21:57:48 +0000 | [diff] [blame] | 64 | // Set StoreCaptures to True so that we can assume in our callers that the |
| 65 | // pointer is not the result of a load instruction. Currently |
| 66 | // PointerMayBeCaptured doesn't have any special analysis for the |
| 67 | // StoreCaptures=false case; if it did, our callers could be refined to be |
| 68 | // more precise. |
| 69 | return !PointerMayBeCaptured(V, false, /*StoreCaptures=*/true); |
Duncan Sands | 91c9c310 | 2009-01-05 21:19:53 +0000 | [diff] [blame] | 70 | |
Chris Lattner | e727579 | 2008-06-16 06:28:01 +0000 | [diff] [blame] | 71 | // If this is an argument that corresponds to a byval or noalias argument, |
Duncan Sands | 91c9c310 | 2009-01-05 21:19:53 +0000 | [diff] [blame] | 72 | // then it has not escaped before entering the function. Check if it escapes |
| 73 | // inside the function. |
Chris Lattner | e727579 | 2008-06-16 06:28:01 +0000 | [diff] [blame] | 74 | if (const Argument *A = dyn_cast<Argument>(V)) |
Duncan Sands | 91c9c310 | 2009-01-05 21:19:53 +0000 | [diff] [blame] | 75 | if (A->hasByValAttr() || A->hasNoAliasAttr()) { |
| 76 | // Don't bother analyzing arguments already known not to escape. |
| 77 | if (A->hasNoCaptureAttr()) |
| 78 | return true; |
Dan Gohman | f94b5ed | 2009-11-19 21:57:48 +0000 | [diff] [blame] | 79 | return !PointerMayBeCaptured(V, false, /*StoreCaptures=*/true); |
Duncan Sands | 91c9c310 | 2009-01-05 21:19:53 +0000 | [diff] [blame] | 80 | } |
Chris Lattner | 845f0d2 | 2008-06-16 06:19:11 +0000 | [diff] [blame] | 81 | return false; |
| 82 | } |
| 83 | |
| 84 | |
Chris Lattner | a413960 | 2008-06-16 06:10:11 +0000 | [diff] [blame] | 85 | /// isObjectSmallerThan - Return true if we can prove that the object specified |
| 86 | /// by V is smaller than Size. |
| 87 | static bool isObjectSmallerThan(const Value *V, unsigned Size, |
Chris Lattner | 7b550cc | 2009-11-06 04:27:31 +0000 | [diff] [blame] | 88 | const TargetData &TD) { |
Chris Lattner | 295d4e9 | 2008-12-08 06:28:54 +0000 | [diff] [blame] | 89 | const Type *AccessTy; |
| 90 | if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(V)) { |
Chris Lattner | a413960 | 2008-06-16 06:10:11 +0000 | [diff] [blame] | 91 | AccessTy = GV->getType()->getElementType(); |
Victor Hernandez | 7b929da | 2009-10-23 21:09:37 +0000 | [diff] [blame] | 92 | } else if (const AllocaInst *AI = dyn_cast<AllocaInst>(V)) { |
Chris Lattner | a413960 | 2008-06-16 06:10:11 +0000 | [diff] [blame] | 93 | if (!AI->isArrayAllocation()) |
| 94 | AccessTy = AI->getType()->getElementType(); |
Chris Lattner | 295d4e9 | 2008-12-08 06:28:54 +0000 | [diff] [blame] | 95 | else |
| 96 | return false; |
Victor Hernandez | 46e8312 | 2009-09-18 21:34:51 +0000 | [diff] [blame] | 97 | } else if (const CallInst* CI = extractMallocCall(V)) { |
Chris Lattner | 7b550cc | 2009-11-06 04:27:31 +0000 | [diff] [blame] | 98 | if (!isArrayMalloc(V, &TD)) |
Victor Hernandez | 46e8312 | 2009-09-18 21:34:51 +0000 | [diff] [blame] | 99 | // The size is the argument to the malloc call. |
| 100 | if (const ConstantInt* C = dyn_cast<ConstantInt>(CI->getOperand(1))) |
| 101 | return (C->getZExtValue() < Size); |
| 102 | return false; |
Chris Lattner | 295d4e9 | 2008-12-08 06:28:54 +0000 | [diff] [blame] | 103 | } else if (const Argument *A = dyn_cast<Argument>(V)) { |
Chris Lattner | a413960 | 2008-06-16 06:10:11 +0000 | [diff] [blame] | 104 | if (A->hasByValAttr()) |
| 105 | AccessTy = cast<PointerType>(A->getType())->getElementType(); |
Chris Lattner | 295d4e9 | 2008-12-08 06:28:54 +0000 | [diff] [blame] | 106 | else |
| 107 | return false; |
| 108 | } else { |
| 109 | return false; |
| 110 | } |
Chris Lattner | a413960 | 2008-06-16 06:10:11 +0000 | [diff] [blame] | 111 | |
Chris Lattner | 295d4e9 | 2008-12-08 06:28:54 +0000 | [diff] [blame] | 112 | if (AccessTy->isSized()) |
Duncan Sands | 777d230 | 2009-05-09 07:06:46 +0000 | [diff] [blame] | 113 | return TD.getTypeAllocSize(AccessTy) < Size; |
Chris Lattner | a413960 | 2008-06-16 06:10:11 +0000 | [diff] [blame] | 114 | return false; |
| 115 | } |
| 116 | |
Chris Lattner | defa1c8 | 2008-06-16 06:30:22 +0000 | [diff] [blame] | 117 | //===----------------------------------------------------------------------===// |
| 118 | // NoAA Pass |
| 119 | //===----------------------------------------------------------------------===// |
| 120 | |
| 121 | namespace { |
| 122 | /// NoAA - This class implements the -no-aa pass, which always returns "I |
| 123 | /// don't know" for alias queries. NoAA is unlike other alias analysis |
| 124 | /// implementations, in that it does not chain to a previous analysis. As |
| 125 | /// such it doesn't follow many of the rules that other alias analyses must. |
| 126 | /// |
Nick Lewycky | 6726b6d | 2009-10-25 06:33:48 +0000 | [diff] [blame] | 127 | struct NoAA : public ImmutablePass, public AliasAnalysis { |
Chris Lattner | defa1c8 | 2008-06-16 06:30:22 +0000 | [diff] [blame] | 128 | static char ID; // Class identification, replacement for typeinfo |
Dan Gohman | ae73dc1 | 2008-09-04 17:05:41 +0000 | [diff] [blame] | 129 | NoAA() : ImmutablePass(&ID) {} |
| 130 | explicit NoAA(void *PID) : ImmutablePass(PID) { } |
Chris Lattner | defa1c8 | 2008-06-16 06:30:22 +0000 | [diff] [blame] | 131 | |
| 132 | virtual void getAnalysisUsage(AnalysisUsage &AU) const { |
Chris Lattner | defa1c8 | 2008-06-16 06:30:22 +0000 | [diff] [blame] | 133 | } |
| 134 | |
| 135 | virtual void initializePass() { |
Dan Gohman | fc2a3ed | 2009-07-25 00:48:42 +0000 | [diff] [blame] | 136 | TD = getAnalysisIfAvailable<TargetData>(); |
Chris Lattner | defa1c8 | 2008-06-16 06:30:22 +0000 | [diff] [blame] | 137 | } |
| 138 | |
| 139 | virtual AliasResult alias(const Value *V1, unsigned V1Size, |
| 140 | const Value *V2, unsigned V2Size) { |
| 141 | return MayAlias; |
| 142 | } |
| 143 | |
Chris Lattner | defa1c8 | 2008-06-16 06:30:22 +0000 | [diff] [blame] | 144 | virtual void getArgumentAccesses(Function *F, CallSite CS, |
| 145 | std::vector<PointerAccessInfo> &Info) { |
Torok Edwin | c23197a | 2009-07-14 16:55:14 +0000 | [diff] [blame] | 146 | llvm_unreachable("This method may not be called on this function!"); |
Chris Lattner | defa1c8 | 2008-06-16 06:30:22 +0000 | [diff] [blame] | 147 | } |
| 148 | |
Chris Lattner | defa1c8 | 2008-06-16 06:30:22 +0000 | [diff] [blame] | 149 | virtual bool pointsToConstantMemory(const Value *P) { return false; } |
| 150 | virtual ModRefResult getModRefInfo(CallSite CS, Value *P, unsigned Size) { |
| 151 | return ModRef; |
| 152 | } |
| 153 | virtual ModRefResult getModRefInfo(CallSite CS1, CallSite CS2) { |
| 154 | return ModRef; |
| 155 | } |
Chris Lattner | defa1c8 | 2008-06-16 06:30:22 +0000 | [diff] [blame] | 156 | |
| 157 | virtual void deleteValue(Value *V) {} |
| 158 | virtual void copyValue(Value *From, Value *To) {} |
| 159 | }; |
| 160 | } // End of anonymous namespace |
| 161 | |
| 162 | // Register this pass... |
| 163 | char NoAA::ID = 0; |
| 164 | static RegisterPass<NoAA> |
| 165 | U("no-aa", "No Alias Analysis (always returns 'may' alias)", true, true); |
| 166 | |
| 167 | // Declare that we implement the AliasAnalysis interface |
| 168 | static RegisterAnalysisGroup<AliasAnalysis> V(U); |
| 169 | |
| 170 | ImmutablePass *llvm::createNoAAPass() { return new NoAA(); } |
| 171 | |
| 172 | //===----------------------------------------------------------------------===// |
| 173 | // BasicAA Pass |
| 174 | //===----------------------------------------------------------------------===// |
| 175 | |
| 176 | namespace { |
| 177 | /// BasicAliasAnalysis - This is the default alias analysis implementation. |
| 178 | /// Because it doesn't chain to a previous alias analysis (like -no-aa), it |
| 179 | /// derives from the NoAA class. |
Nick Lewycky | 6726b6d | 2009-10-25 06:33:48 +0000 | [diff] [blame] | 180 | struct BasicAliasAnalysis : public NoAA { |
Chris Lattner | defa1c8 | 2008-06-16 06:30:22 +0000 | [diff] [blame] | 181 | static char ID; // Class identification, replacement for typeinfo |
Dan Gohman | ae73dc1 | 2008-09-04 17:05:41 +0000 | [diff] [blame] | 182 | BasicAliasAnalysis() : NoAA(&ID) {} |
Chris Lattner | defa1c8 | 2008-06-16 06:30:22 +0000 | [diff] [blame] | 183 | AliasResult alias(const Value *V1, unsigned V1Size, |
Evan Cheng | 50a5914 | 2009-10-13 22:02:20 +0000 | [diff] [blame] | 184 | const Value *V2, unsigned V2Size) { |
Evan Cheng | f0429fd | 2009-10-14 06:46:26 +0000 | [diff] [blame] | 185 | assert(VisitedPHIs.empty() && "VisitedPHIs must be cleared after use!"); |
| 186 | AliasResult Alias = aliasCheck(V1, V1Size, V2, V2Size); |
Evan Cheng | 3dbe43b | 2009-10-14 05:05:02 +0000 | [diff] [blame] | 187 | VisitedPHIs.clear(); |
Evan Cheng | f0429fd | 2009-10-14 06:46:26 +0000 | [diff] [blame] | 188 | return Alias; |
Evan Cheng | 50a5914 | 2009-10-13 22:02:20 +0000 | [diff] [blame] | 189 | } |
Chris Lattner | defa1c8 | 2008-06-16 06:30:22 +0000 | [diff] [blame] | 190 | |
| 191 | ModRefResult getModRefInfo(CallSite CS, Value *P, unsigned Size); |
Chris Lattner | 20d6f09 | 2008-12-09 21:19:42 +0000 | [diff] [blame] | 192 | ModRefResult getModRefInfo(CallSite CS1, CallSite CS2); |
Owen Anderson | e794220 | 2009-02-05 23:36:27 +0000 | [diff] [blame] | 193 | |
Chris Lattner | defa1c8 | 2008-06-16 06:30:22 +0000 | [diff] [blame] | 194 | /// pointsToConstantMemory - Chase pointers until we find a (constant |
| 195 | /// global) or not. |
| 196 | bool pointsToConstantMemory(const Value *P); |
| 197 | |
| 198 | private: |
Evan Cheng | 3dbe43b | 2009-10-14 05:05:02 +0000 | [diff] [blame] | 199 | // VisitedPHIs - Track PHI nodes visited by a aliasCheck() call. |
Dan Gohman | 6665b0e | 2009-10-26 21:55:43 +0000 | [diff] [blame] | 200 | SmallPtrSet<const Value*, 16> VisitedPHIs; |
Evan Cheng | 3dbe43b | 2009-10-14 05:05:02 +0000 | [diff] [blame] | 201 | |
Chris Lattner | 5d56b2d | 2009-11-23 16:45:27 +0000 | [diff] [blame] | 202 | // aliasGEP - Provide a bunch of ad-hoc rules to disambiguate a GEP |
| 203 | // instruction against another. |
Chris Lattner | 539c9b9 | 2009-11-26 02:11:08 +0000 | [diff] [blame] | 204 | AliasResult aliasGEP(const GEPOperator *V1, unsigned V1Size, |
Chris Lattner | 23e2a5b | 2009-11-26 02:14:59 +0000 | [diff] [blame] | 205 | const Value *V2, unsigned V2Size, |
| 206 | const Value *UnderlyingV1, const Value *UnderlyingV2); |
Evan Cheng | 50a5914 | 2009-10-13 22:02:20 +0000 | [diff] [blame] | 207 | |
Chris Lattner | 5d56b2d | 2009-11-23 16:45:27 +0000 | [diff] [blame] | 208 | // aliasPHI - Provide a bunch of ad-hoc rules to disambiguate a PHI |
| 209 | // instruction against another. |
Evan Cheng | d83c2ca | 2009-10-14 05:22:03 +0000 | [diff] [blame] | 210 | AliasResult aliasPHI(const PHINode *PN, unsigned PNSize, |
Evan Cheng | 3dbe43b | 2009-10-14 05:05:02 +0000 | [diff] [blame] | 211 | const Value *V2, unsigned V2Size); |
Evan Cheng | 50a5914 | 2009-10-13 22:02:20 +0000 | [diff] [blame] | 212 | |
Dan Gohman | 6665b0e | 2009-10-26 21:55:43 +0000 | [diff] [blame] | 213 | /// aliasSelect - Disambiguate a Select instruction against another value. |
| 214 | AliasResult aliasSelect(const SelectInst *SI, unsigned SISize, |
| 215 | const Value *V2, unsigned V2Size); |
| 216 | |
Evan Cheng | 50a5914 | 2009-10-13 22:02:20 +0000 | [diff] [blame] | 217 | AliasResult aliasCheck(const Value *V1, unsigned V1Size, |
Evan Cheng | 3dbe43b | 2009-10-14 05:05:02 +0000 | [diff] [blame] | 218 | const Value *V2, unsigned V2Size); |
Chris Lattner | defa1c8 | 2008-06-16 06:30:22 +0000 | [diff] [blame] | 219 | }; |
| 220 | } // End of anonymous namespace |
| 221 | |
| 222 | // Register this pass... |
| 223 | char BasicAliasAnalysis::ID = 0; |
| 224 | static RegisterPass<BasicAliasAnalysis> |
| 225 | X("basicaa", "Basic Alias Analysis (default AA impl)", false, true); |
| 226 | |
| 227 | // Declare that we implement the AliasAnalysis interface |
| 228 | static RegisterAnalysisGroup<AliasAnalysis, true> Y(X); |
| 229 | |
| 230 | ImmutablePass *llvm::createBasicAliasAnalysisPass() { |
| 231 | return new BasicAliasAnalysis(); |
| 232 | } |
| 233 | |
| 234 | |
| 235 | /// pointsToConstantMemory - Chase pointers until we find a (constant |
| 236 | /// global) or not. |
| 237 | bool BasicAliasAnalysis::pointsToConstantMemory(const Value *P) { |
| 238 | if (const GlobalVariable *GV = |
Duncan Sands | 5d0392c | 2008-10-01 15:25:41 +0000 | [diff] [blame] | 239 | dyn_cast<GlobalVariable>(P->getUnderlyingObject())) |
Chris Lattner | b27db37 | 2009-11-23 17:07:35 +0000 | [diff] [blame] | 240 | // Note: this doesn't require GV to be "ODR" because it isn't legal for a |
| 241 | // global to be marked constant in some modules and non-constant in others. |
| 242 | // GV may even be a declaration, not a definition. |
Chris Lattner | defa1c8 | 2008-06-16 06:30:22 +0000 | [diff] [blame] | 243 | return GV->isConstant(); |
| 244 | return false; |
| 245 | } |
| 246 | |
Owen Anderson | e794220 | 2009-02-05 23:36:27 +0000 | [diff] [blame] | 247 | |
Chris Lattner | 5d56b2d | 2009-11-23 16:45:27 +0000 | [diff] [blame] | 248 | /// getModRefInfo - Check to see if the specified callsite can clobber the |
| 249 | /// specified memory object. Since we only look at local properties of this |
| 250 | /// function, we really can't say much about this query. We do, however, use |
| 251 | /// simple "address taken" analysis on local objects. |
Chris Lattner | defa1c8 | 2008-06-16 06:30:22 +0000 | [diff] [blame] | 252 | AliasAnalysis::ModRefResult |
| 253 | BasicAliasAnalysis::getModRefInfo(CallSite CS, Value *P, unsigned Size) { |
Chris Lattner | 92e803c | 2009-11-22 16:05:05 +0000 | [diff] [blame] | 254 | const Value *Object = P->getUnderlyingObject(); |
| 255 | |
| 256 | // If this is a tail call and P points to a stack location, we know that |
| 257 | // the tail call cannot access or modify the local stack. |
| 258 | // We cannot exclude byval arguments here; these belong to the caller of |
| 259 | // the current function not to the current function, and a tail callee |
| 260 | // may reference them. |
| 261 | if (isa<AllocaInst>(Object)) |
| 262 | if (CallInst *CI = dyn_cast<CallInst>(CS.getInstruction())) |
| 263 | if (CI->isTailCall()) |
| 264 | return NoModRef; |
| 265 | |
| 266 | // If the pointer is to a locally allocated object that does not escape, |
Chris Lattner | b34b82e | 2009-11-23 16:44:43 +0000 | [diff] [blame] | 267 | // then the call can not mod/ref the pointer unless the call takes the pointer |
| 268 | // as an argument, and itself doesn't capture it. |
Chris Lattner | 403ac2e | 2009-11-23 16:46:41 +0000 | [diff] [blame] | 269 | if (!isa<Constant>(Object) && CS.getInstruction() != Object && |
| 270 | isNonEscapingLocalObject(Object)) { |
Chris Lattner | b34b82e | 2009-11-23 16:44:43 +0000 | [diff] [blame] | 271 | bool PassedAsArg = false; |
| 272 | unsigned ArgNo = 0; |
Chris Lattner | 92e803c | 2009-11-22 16:05:05 +0000 | [diff] [blame] | 273 | for (CallSite::arg_iterator CI = CS.arg_begin(), CE = CS.arg_end(); |
Chris Lattner | b34b82e | 2009-11-23 16:44:43 +0000 | [diff] [blame] | 274 | CI != CE; ++CI, ++ArgNo) { |
| 275 | // Only look at the no-capture pointer arguments. |
| 276 | if (!isa<PointerType>((*CI)->getType()) || |
| 277 | !CS.paramHasAttr(ArgNo+1, Attribute::NoCapture)) |
| 278 | continue; |
| 279 | |
| 280 | // If this is a no-capture pointer argument, see if we can tell that it |
| 281 | // is impossible to alias the pointer we're checking. If not, we have to |
| 282 | // assume that the call could touch the pointer, even though it doesn't |
| 283 | // escape. |
Chris Lattner | 403ac2e | 2009-11-23 16:46:41 +0000 | [diff] [blame] | 284 | if (!isNoAlias(cast<Value>(CI), ~0U, P, ~0U)) { |
Chris Lattner | b34b82e | 2009-11-23 16:44:43 +0000 | [diff] [blame] | 285 | PassedAsArg = true; |
| 286 | break; |
| 287 | } |
| 288 | } |
Chris Lattner | defa1c8 | 2008-06-16 06:30:22 +0000 | [diff] [blame] | 289 | |
Chris Lattner | b34b82e | 2009-11-23 16:44:43 +0000 | [diff] [blame] | 290 | if (!PassedAsArg) |
Chris Lattner | 92e803c | 2009-11-22 16:05:05 +0000 | [diff] [blame] | 291 | return NoModRef; |
| 292 | } |
| 293 | |
| 294 | // Finally, handle specific knowledge of intrinsics. |
| 295 | IntrinsicInst *II = dyn_cast<IntrinsicInst>(CS.getInstruction()); |
| 296 | if (II == 0) |
| 297 | return AliasAnalysis::getModRefInfo(CS, P, Size); |
| 298 | |
| 299 | switch (II->getIntrinsicID()) { |
| 300 | default: break; |
| 301 | case Intrinsic::memcpy: |
| 302 | case Intrinsic::memmove: { |
| 303 | unsigned Len = ~0U; |
| 304 | if (ConstantInt *LenCI = dyn_cast<ConstantInt>(II->getOperand(3))) |
| 305 | Len = LenCI->getZExtValue(); |
| 306 | Value *Dest = II->getOperand(1); |
| 307 | Value *Src = II->getOperand(2); |
Chris Lattner | 403ac2e | 2009-11-23 16:46:41 +0000 | [diff] [blame] | 308 | if (isNoAlias(Dest, Len, P, Size)) { |
| 309 | if (isNoAlias(Src, Len, P, Size)) |
Chris Lattner | 92e803c | 2009-11-22 16:05:05 +0000 | [diff] [blame] | 310 | return NoModRef; |
| 311 | return Ref; |
| 312 | } |
| 313 | break; |
| 314 | } |
| 315 | case Intrinsic::memset: |
Chris Lattner | 403ac2e | 2009-11-23 16:46:41 +0000 | [diff] [blame] | 316 | // Since memset is 'accesses arguments' only, the AliasAnalysis base class |
| 317 | // will handle it for the variable length case. |
Chris Lattner | 92e803c | 2009-11-22 16:05:05 +0000 | [diff] [blame] | 318 | if (ConstantInt *LenCI = dyn_cast<ConstantInt>(II->getOperand(3))) { |
| 319 | unsigned Len = LenCI->getZExtValue(); |
| 320 | Value *Dest = II->getOperand(1); |
Chris Lattner | 403ac2e | 2009-11-23 16:46:41 +0000 | [diff] [blame] | 321 | if (isNoAlias(Dest, Len, P, Size)) |
Chris Lattner | 25df20f | 2008-06-16 06:38:26 +0000 | [diff] [blame] | 322 | return NoModRef; |
Chris Lattner | defa1c8 | 2008-06-16 06:30:22 +0000 | [diff] [blame] | 323 | } |
Chris Lattner | 92e803c | 2009-11-22 16:05:05 +0000 | [diff] [blame] | 324 | break; |
| 325 | case Intrinsic::atomic_cmp_swap: |
| 326 | case Intrinsic::atomic_swap: |
| 327 | case Intrinsic::atomic_load_add: |
| 328 | case Intrinsic::atomic_load_sub: |
| 329 | case Intrinsic::atomic_load_and: |
| 330 | case Intrinsic::atomic_load_nand: |
| 331 | case Intrinsic::atomic_load_or: |
| 332 | case Intrinsic::atomic_load_xor: |
| 333 | case Intrinsic::atomic_load_max: |
| 334 | case Intrinsic::atomic_load_min: |
| 335 | case Intrinsic::atomic_load_umax: |
| 336 | case Intrinsic::atomic_load_umin: |
| 337 | if (TD) { |
| 338 | Value *Op1 = II->getOperand(1); |
| 339 | unsigned Op1Size = TD->getTypeStoreSize(Op1->getType()); |
Chris Lattner | 403ac2e | 2009-11-23 16:46:41 +0000 | [diff] [blame] | 340 | if (isNoAlias(Op1, Op1Size, P, Size)) |
Chris Lattner | 92e803c | 2009-11-22 16:05:05 +0000 | [diff] [blame] | 341 | return NoModRef; |
Nick Lewycky | 5c9be67 | 2009-10-13 07:48:38 +0000 | [diff] [blame] | 342 | } |
Chris Lattner | 92e803c | 2009-11-22 16:05:05 +0000 | [diff] [blame] | 343 | break; |
| 344 | case Intrinsic::lifetime_start: |
| 345 | case Intrinsic::lifetime_end: |
| 346 | case Intrinsic::invariant_start: { |
| 347 | unsigned PtrSize = cast<ConstantInt>(II->getOperand(1))->getZExtValue(); |
Chris Lattner | 403ac2e | 2009-11-23 16:46:41 +0000 | [diff] [blame] | 348 | if (isNoAlias(II->getOperand(2), PtrSize, P, Size)) |
Chris Lattner | 92e803c | 2009-11-22 16:05:05 +0000 | [diff] [blame] | 349 | return NoModRef; |
| 350 | break; |
| 351 | } |
| 352 | case Intrinsic::invariant_end: { |
| 353 | unsigned PtrSize = cast<ConstantInt>(II->getOperand(2))->getZExtValue(); |
Chris Lattner | 403ac2e | 2009-11-23 16:46:41 +0000 | [diff] [blame] | 354 | if (isNoAlias(II->getOperand(3), PtrSize, P, Size)) |
Chris Lattner | 92e803c | 2009-11-22 16:05:05 +0000 | [diff] [blame] | 355 | return NoModRef; |
| 356 | break; |
| 357 | } |
Chris Lattner | defa1c8 | 2008-06-16 06:30:22 +0000 | [diff] [blame] | 358 | } |
| 359 | |
| 360 | // The AliasAnalysis base class has some smarts, lets use them. |
| 361 | return AliasAnalysis::getModRefInfo(CS, P, Size); |
| 362 | } |
| 363 | |
| 364 | |
Chris Lattner | 20d6f09 | 2008-12-09 21:19:42 +0000 | [diff] [blame] | 365 | AliasAnalysis::ModRefResult |
| 366 | BasicAliasAnalysis::getModRefInfo(CallSite CS1, CallSite CS2) { |
| 367 | // If CS1 or CS2 are readnone, they don't interact. |
| 368 | ModRefBehavior CS1B = AliasAnalysis::getModRefBehavior(CS1); |
| 369 | if (CS1B == DoesNotAccessMemory) return NoModRef; |
| 370 | |
| 371 | ModRefBehavior CS2B = AliasAnalysis::getModRefBehavior(CS2); |
| 372 | if (CS2B == DoesNotAccessMemory) return NoModRef; |
| 373 | |
| 374 | // If they both only read from memory, just return ref. |
| 375 | if (CS1B == OnlyReadsMemory && CS2B == OnlyReadsMemory) |
| 376 | return Ref; |
| 377 | |
| 378 | // Otherwise, fall back to NoAA (mod+ref). |
| 379 | return NoAA::getModRefInfo(CS1, CS2); |
| 380 | } |
| 381 | |
Chris Lattner | f6ac4d9 | 2009-11-26 16:18:10 +0000 | [diff] [blame] | 382 | /// GetLinearExpression - Analyze the specified value as a linear expression: |
| 383 | /// "A*V + B". Return the scale and offset values as APInts and return V as a |
| 384 | /// Value*. The incoming Value is known to be a scalar integer. |
Chris Lattner | 5d5261c | 2009-11-26 16:26:43 +0000 | [diff] [blame] | 385 | static Value *GetLinearExpression(Value *V, APInt &Scale, APInt &Offset, |
| 386 | const TargetData *TD) { |
Chris Lattner | f6ac4d9 | 2009-11-26 16:18:10 +0000 | [diff] [blame] | 387 | assert(isa<IntegerType>(V->getType()) && "Not an integer value"); |
| 388 | |
| 389 | if (BinaryOperator *BOp = dyn_cast<BinaryOperator>(V)) { |
| 390 | if (ConstantInt *RHSC = dyn_cast<ConstantInt>(BOp->getOperand(1))) { |
| 391 | switch (BOp->getOpcode()) { |
| 392 | default: break; |
Chris Lattner | 5d5261c | 2009-11-26 16:26:43 +0000 | [diff] [blame] | 393 | case Instruction::Or: |
| 394 | // X|C == X+C if all the bits in C are unset in X. Otherwise we can't |
| 395 | // analyze it. |
| 396 | if (!MaskedValueIsZero(BOp->getOperand(0), RHSC->getValue(), TD)) |
| 397 | break; |
| 398 | // FALL THROUGH. |
Chris Lattner | f6ac4d9 | 2009-11-26 16:18:10 +0000 | [diff] [blame] | 399 | case Instruction::Add: |
Chris Lattner | 5d5261c | 2009-11-26 16:26:43 +0000 | [diff] [blame] | 400 | V = GetLinearExpression(BOp->getOperand(0), Scale, Offset, TD); |
Chris Lattner | f6ac4d9 | 2009-11-26 16:18:10 +0000 | [diff] [blame] | 401 | Offset += RHSC->getValue(); |
| 402 | return V; |
Chris Lattner | fa39668 | 2009-11-26 17:00:01 +0000 | [diff] [blame^] | 403 | case Instruction::Mul: |
| 404 | V = GetLinearExpression(BOp->getOperand(0), Scale, Offset, TD); |
| 405 | Offset *= RHSC->getValue(); |
| 406 | Scale *= RHSC->getValue(); |
| 407 | return V; |
| 408 | case Instruction::Shl: |
| 409 | V = GetLinearExpression(BOp->getOperand(0), Scale, Offset, TD); |
| 410 | Offset <<= RHSC->getValue().getLimitedValue(); |
| 411 | Scale <<= RHSC->getValue().getLimitedValue(); |
| 412 | return V; |
Chris Lattner | f6ac4d9 | 2009-11-26 16:18:10 +0000 | [diff] [blame] | 413 | } |
| 414 | } |
| 415 | } |
| 416 | |
| 417 | Scale = 1; |
| 418 | Offset = 0; |
| 419 | return V; |
| 420 | } |
| 421 | |
Chris Lattner | 4e91ee7 | 2009-11-26 02:13:03 +0000 | [diff] [blame] | 422 | /// DecomposeGEPExpression - If V is a symbolic pointer expression, decompose it |
| 423 | /// into a base pointer with a constant offset and a number of scaled symbolic |
| 424 | /// offsets. |
Chris Lattner | 23e2a5b | 2009-11-26 02:14:59 +0000 | [diff] [blame] | 425 | /// |
| 426 | /// When TargetData is around, this function is capable of analyzing everything |
| 427 | /// that Value::getUnderlyingObject() can look through. When not, it just looks |
| 428 | /// through pointer casts. |
| 429 | /// |
| 430 | /// FIXME: Move this out to ValueTracking.cpp |
| 431 | /// |
Chris Lattner | 4e91ee7 | 2009-11-26 02:13:03 +0000 | [diff] [blame] | 432 | static const Value *DecomposeGEPExpression(const Value *V, int64_t &BaseOffs, |
Chris Lattner | d84eb91 | 2009-11-26 02:17:34 +0000 | [diff] [blame] | 433 | SmallVectorImpl<std::pair<const Value*, int64_t> > &VarIndices, |
Chris Lattner | 4e91ee7 | 2009-11-26 02:13:03 +0000 | [diff] [blame] | 434 | const TargetData *TD) { |
Chris Lattner | 23e2a5b | 2009-11-26 02:14:59 +0000 | [diff] [blame] | 435 | // FIXME: Should limit depth like getUnderlyingObject? |
Chris Lattner | 4e91ee7 | 2009-11-26 02:13:03 +0000 | [diff] [blame] | 436 | BaseOffs = 0; |
| 437 | while (1) { |
| 438 | // See if this is a bitcast or GEP. |
| 439 | const Operator *Op = dyn_cast<Operator>(V); |
Chris Lattner | 23e2a5b | 2009-11-26 02:14:59 +0000 | [diff] [blame] | 440 | if (Op == 0) { |
| 441 | // The only non-operator case we can handle are GlobalAliases. |
| 442 | if (const GlobalAlias *GA = dyn_cast<GlobalAlias>(V)) { |
| 443 | if (!GA->mayBeOverridden()) { |
| 444 | V = GA->getAliasee(); |
| 445 | continue; |
| 446 | } |
| 447 | } |
| 448 | return V; |
| 449 | } |
Chris Lattner | 4e91ee7 | 2009-11-26 02:13:03 +0000 | [diff] [blame] | 450 | |
| 451 | if (Op->getOpcode() == Instruction::BitCast) { |
| 452 | V = Op->getOperand(0); |
| 453 | continue; |
| 454 | } |
| 455 | |
Chris Lattner | 23e2a5b | 2009-11-26 02:14:59 +0000 | [diff] [blame] | 456 | const GEPOperator *GEPOp = dyn_cast<GEPOperator>(Op); |
| 457 | if (GEPOp == 0) |
Chris Lattner | 4e91ee7 | 2009-11-26 02:13:03 +0000 | [diff] [blame] | 458 | return V; |
| 459 | |
| 460 | // Don't attempt to analyze GEPs over unsized objects. |
Chris Lattner | 23e2a5b | 2009-11-26 02:14:59 +0000 | [diff] [blame] | 461 | if (!cast<PointerType>(GEPOp->getOperand(0)->getType()) |
Chris Lattner | 4e91ee7 | 2009-11-26 02:13:03 +0000 | [diff] [blame] | 462 | ->getElementType()->isSized()) |
| 463 | return V; |
Chris Lattner | 23e2a5b | 2009-11-26 02:14:59 +0000 | [diff] [blame] | 464 | |
| 465 | // If we are lacking TargetData information, we can't compute the offets of |
| 466 | // elements computed by GEPs. However, we can handle bitcast equivalent |
| 467 | // GEPs. |
| 468 | if (!TD) { |
| 469 | if (!GEPOp->hasAllZeroIndices()) |
| 470 | return V; |
| 471 | V = GEPOp->getOperand(0); |
| 472 | continue; |
| 473 | } |
Chris Lattner | 4e91ee7 | 2009-11-26 02:13:03 +0000 | [diff] [blame] | 474 | |
| 475 | // Walk the indices of the GEP, accumulating them into BaseOff/VarIndices. |
Chris Lattner | 23e2a5b | 2009-11-26 02:14:59 +0000 | [diff] [blame] | 476 | gep_type_iterator GTI = gep_type_begin(GEPOp); |
| 477 | for (User::const_op_iterator I = next(GEPOp->op_begin()), |
| 478 | E = GEPOp->op_end(); I != E; ++I) { |
Chris Lattner | 4e91ee7 | 2009-11-26 02:13:03 +0000 | [diff] [blame] | 479 | Value *Index = *I; |
| 480 | // Compute the (potentially symbolic) offset in bytes for this index. |
| 481 | if (const StructType *STy = dyn_cast<StructType>(*GTI++)) { |
| 482 | // For a struct, add the member offset. |
| 483 | unsigned FieldNo = cast<ConstantInt>(Index)->getZExtValue(); |
| 484 | if (FieldNo == 0) continue; |
Chris Lattner | 4e91ee7 | 2009-11-26 02:13:03 +0000 | [diff] [blame] | 485 | |
| 486 | BaseOffs += TD->getStructLayout(STy)->getElementOffset(FieldNo); |
| 487 | continue; |
| 488 | } |
| 489 | |
| 490 | // For an array/pointer, add the element offset, explicitly scaled. |
| 491 | if (ConstantInt *CIdx = dyn_cast<ConstantInt>(Index)) { |
| 492 | if (CIdx->isZero()) continue; |
Chris Lattner | 4e91ee7 | 2009-11-26 02:13:03 +0000 | [diff] [blame] | 493 | BaseOffs += TD->getTypeAllocSize(*GTI)*CIdx->getSExtValue(); |
| 494 | continue; |
| 495 | } |
| 496 | |
Chris Lattner | 4e91ee7 | 2009-11-26 02:13:03 +0000 | [diff] [blame] | 497 | // TODO: Could handle linear expressions here like A[X+1], also A[X*4|1]. |
| 498 | uint64_t Scale = TD->getTypeAllocSize(*GTI); |
| 499 | |
Chris Lattner | f6ac4d9 | 2009-11-26 16:18:10 +0000 | [diff] [blame] | 500 | unsigned Width = cast<IntegerType>(Index->getType())->getBitWidth(); |
| 501 | APInt IndexScale(Width, 0), IndexOffset(Width, 0); |
Chris Lattner | 5d5261c | 2009-11-26 16:26:43 +0000 | [diff] [blame] | 502 | Index = GetLinearExpression(Index, IndexScale, IndexOffset, TD); |
Chris Lattner | f6ac4d9 | 2009-11-26 16:18:10 +0000 | [diff] [blame] | 503 | |
| 504 | Scale *= IndexScale.getZExtValue(); |
| 505 | BaseOffs += IndexOffset.getZExtValue()*Scale; |
| 506 | |
| 507 | |
Chris Lattner | 4e91ee7 | 2009-11-26 02:13:03 +0000 | [diff] [blame] | 508 | // If we already had an occurrance of this index variable, merge this |
| 509 | // scale into it. For example, we want to handle: |
| 510 | // A[x][x] -> x*16 + x*4 -> x*20 |
Chris Lattner | d84eb91 | 2009-11-26 02:17:34 +0000 | [diff] [blame] | 511 | // This also ensures that 'x' only appears in the index list once. |
Chris Lattner | 4e91ee7 | 2009-11-26 02:13:03 +0000 | [diff] [blame] | 512 | for (unsigned i = 0, e = VarIndices.size(); i != e; ++i) { |
| 513 | if (VarIndices[i].first == Index) { |
| 514 | Scale += VarIndices[i].second; |
| 515 | VarIndices.erase(VarIndices.begin()+i); |
| 516 | break; |
| 517 | } |
| 518 | } |
| 519 | |
| 520 | // Make sure that we have a scale that makes sense for this target's |
| 521 | // pointer size. |
| 522 | if (unsigned ShiftBits = 64-TD->getPointerSizeInBits()) { |
| 523 | Scale <<= ShiftBits; |
| 524 | Scale >>= ShiftBits; |
| 525 | } |
| 526 | |
| 527 | if (Scale) |
| 528 | VarIndices.push_back(std::make_pair(Index, Scale)); |
| 529 | } |
| 530 | |
| 531 | // Analyze the base pointer next. |
Chris Lattner | 23e2a5b | 2009-11-26 02:14:59 +0000 | [diff] [blame] | 532 | V = GEPOp->getOperand(0); |
Chris Lattner | 4e91ee7 | 2009-11-26 02:13:03 +0000 | [diff] [blame] | 533 | } |
Chris Lattner | 4e91ee7 | 2009-11-26 02:13:03 +0000 | [diff] [blame] | 534 | } |
| 535 | |
Chris Lattner | d84eb91 | 2009-11-26 02:17:34 +0000 | [diff] [blame] | 536 | /// GetIndiceDifference - Dest and Src are the variable indices from two |
| 537 | /// decomposed GetElementPtr instructions GEP1 and GEP2 which have common base |
| 538 | /// pointers. Subtract the GEP2 indices from GEP1 to find the symbolic |
| 539 | /// difference between the two pointers. |
| 540 | static void GetIndiceDifference( |
| 541 | SmallVectorImpl<std::pair<const Value*, int64_t> > &Dest, |
| 542 | const SmallVectorImpl<std::pair<const Value*, int64_t> > &Src) { |
| 543 | if (Src.empty()) return; |
| 544 | |
| 545 | for (unsigned i = 0, e = Src.size(); i != e; ++i) { |
| 546 | const Value *V = Src[i].first; |
| 547 | int64_t Scale = Src[i].second; |
| 548 | |
| 549 | // Find V in Dest. This is N^2, but pointer indices almost never have more |
| 550 | // than a few variable indexes. |
| 551 | for (unsigned j = 0, e = Dest.size(); j != e; ++j) { |
| 552 | if (Dest[j].first != V) continue; |
| 553 | |
| 554 | // If we found it, subtract off Scale V's from the entry in Dest. If it |
| 555 | // goes to zero, remove the entry. |
| 556 | if (Dest[j].second != Scale) |
| 557 | Dest[j].second -= Scale; |
| 558 | else |
| 559 | Dest.erase(Dest.begin()+j); |
| 560 | Scale = 0; |
| 561 | break; |
| 562 | } |
| 563 | |
| 564 | // If we didn't consume this entry, add it to the end of the Dest list. |
| 565 | if (Scale) |
| 566 | Dest.push_back(std::make_pair(V, -Scale)); |
| 567 | } |
| 568 | } |
Chris Lattner | 4e91ee7 | 2009-11-26 02:13:03 +0000 | [diff] [blame] | 569 | |
Chris Lattner | 539c9b9 | 2009-11-26 02:11:08 +0000 | [diff] [blame] | 570 | /// aliasGEP - Provide a bunch of ad-hoc rules to disambiguate a GEP instruction |
| 571 | /// against another pointer. We know that V1 is a GEP, but we don't know |
Chris Lattner | 23e2a5b | 2009-11-26 02:14:59 +0000 | [diff] [blame] | 572 | /// anything about V2. UnderlyingV1 is GEP1->getUnderlyingObject(), |
| 573 | /// UnderlyingV2 is the same for V2. |
Chris Lattner | 539c9b9 | 2009-11-26 02:11:08 +0000 | [diff] [blame] | 574 | /// |
Chris Lattner | d501c13 | 2003-02-26 19:41:54 +0000 | [diff] [blame] | 575 | AliasAnalysis::AliasResult |
Chris Lattner | 539c9b9 | 2009-11-26 02:11:08 +0000 | [diff] [blame] | 576 | BasicAliasAnalysis::aliasGEP(const GEPOperator *GEP1, unsigned V1Size, |
Chris Lattner | 23e2a5b | 2009-11-26 02:14:59 +0000 | [diff] [blame] | 577 | const Value *V2, unsigned V2Size, |
| 578 | const Value *UnderlyingV1, |
| 579 | const Value *UnderlyingV2) { |
Chris Lattner | d84eb91 | 2009-11-26 02:17:34 +0000 | [diff] [blame] | 580 | int64_t GEP1BaseOffset; |
| 581 | SmallVector<std::pair<const Value*, int64_t>, 4> GEP1VariableIndices; |
| 582 | |
Chris Lattner | b307c88 | 2003-12-11 22:44:13 +0000 | [diff] [blame] | 583 | // If we have two gep instructions with must-alias'ing base pointers, figure |
| 584 | // out if the indexes to the GEP tell us anything about the derived pointer. |
Chris Lattner | 539c9b9 | 2009-11-26 02:11:08 +0000 | [diff] [blame] | 585 | if (const GEPOperator *GEP2 = dyn_cast<GEPOperator>(V2)) { |
Chris Lattner | b307c88 | 2003-12-11 22:44:13 +0000 | [diff] [blame] | 586 | // Do the base pointers alias? |
Chris Lattner | d84eb91 | 2009-11-26 02:17:34 +0000 | [diff] [blame] | 587 | AliasResult BaseAlias = aliasCheck(UnderlyingV1, ~0U, UnderlyingV2, ~0U); |
| 588 | |
| 589 | // If we get a No or May, then return it immediately, no amount of analysis |
| 590 | // will improve this situation. |
| 591 | if (BaseAlias != MustAlias) return BaseAlias; |
| 592 | |
| 593 | // Otherwise, we have a MustAlias. Since the base pointers alias each other |
| 594 | // exactly, see if the computed offset from the common pointer tells us |
| 595 | // about the relation of the resulting pointer. |
| 596 | const Value *GEP1BasePtr = |
| 597 | DecomposeGEPExpression(GEP1, GEP1BaseOffset, GEP1VariableIndices, TD); |
| 598 | |
| 599 | int64_t GEP2BaseOffset; |
| 600 | SmallVector<std::pair<const Value*, int64_t>, 4> GEP2VariableIndices; |
| 601 | const Value *GEP2BasePtr = |
| 602 | DecomposeGEPExpression(GEP2, GEP2BaseOffset, GEP2VariableIndices, TD); |
| 603 | |
| 604 | // If DecomposeGEPExpression isn't able to look all the way through the |
| 605 | // addressing operation, we must not have TD and this is too complex for us |
| 606 | // to handle without it. |
| 607 | if (GEP1BasePtr != UnderlyingV1 || GEP2BasePtr != UnderlyingV2) { |
| 608 | assert(TD == 0 && |
| 609 | "DecomposeGEPExpression and getUnderlyingObject disagree!"); |
| 610 | return MayAlias; |
| 611 | } |
| 612 | |
| 613 | // Subtract the GEP2 pointer from the GEP1 pointer to find out their |
| 614 | // symbolic difference. |
| 615 | GEP1BaseOffset -= GEP2BaseOffset; |
| 616 | GetIndiceDifference(GEP1VariableIndices, GEP2VariableIndices); |
| 617 | |
| 618 | } else { |
| 619 | // Check to see if these two pointers are related by the getelementptr |
| 620 | // instruction. If one pointer is a GEP with a non-zero index of the other |
| 621 | // pointer, we know they cannot alias. |
Chris Lattner | 5369250 | 2009-11-26 16:52:32 +0000 | [diff] [blame] | 622 | |
| 623 | // If both accesses are unknown size, we can't do anything useful here. |
| 624 | if (V1Size == ~0U && V2Size == ~0U) |
Chris Lattner | d84eb91 | 2009-11-26 02:17:34 +0000 | [diff] [blame] | 625 | return MayAlias; |
Chris Lattner | b307c88 | 2003-12-11 22:44:13 +0000 | [diff] [blame] | 626 | |
Chris Lattner | d84eb91 | 2009-11-26 02:17:34 +0000 | [diff] [blame] | 627 | AliasResult R = aliasCheck(UnderlyingV1, ~0U, V2, V2Size); |
| 628 | if (R != MustAlias) |
| 629 | // If V2 may alias GEP base pointer, conservatively returns MayAlias. |
| 630 | // If V2 is known not to alias GEP base pointer, then the two values |
| 631 | // cannot alias per GEP semantics: "A pointer value formed from a |
| 632 | // getelementptr instruction is associated with the addresses associated |
| 633 | // with the first operand of the getelementptr". |
| 634 | return R; |
Chris Lattner | b307c88 | 2003-12-11 22:44:13 +0000 | [diff] [blame] | 635 | |
Chris Lattner | d84eb91 | 2009-11-26 02:17:34 +0000 | [diff] [blame] | 636 | const Value *GEP1BasePtr = |
| 637 | DecomposeGEPExpression(GEP1, GEP1BaseOffset, GEP1VariableIndices, TD); |
| 638 | |
| 639 | // If DecomposeGEPExpression isn't able to look all the way through the |
| 640 | // addressing operation, we must not have TD and this is too complex for us |
| 641 | // to handle without it. |
| 642 | if (GEP1BasePtr != UnderlyingV1) { |
| 643 | assert(TD == 0 && |
| 644 | "DecomposeGEPExpression and getUnderlyingObject disagree!"); |
| 645 | return MayAlias; |
Chris Lattner | b307c88 | 2003-12-11 22:44:13 +0000 | [diff] [blame] | 646 | } |
| 647 | } |
Chris Lattner | d84eb91 | 2009-11-26 02:17:34 +0000 | [diff] [blame] | 648 | |
| 649 | // In the two GEP Case, if there is no difference in the offsets of the |
| 650 | // computed pointers, the resultant pointers are a must alias. This |
| 651 | // hapens when we have two lexically identical GEP's (for example). |
Chris Lattner | d501c13 | 2003-02-26 19:41:54 +0000 | [diff] [blame] | 652 | // |
Chris Lattner | d84eb91 | 2009-11-26 02:17:34 +0000 | [diff] [blame] | 653 | // In the other case, if we have getelementptr <ptr>, 0, 0, 0, 0, ... and V2 |
| 654 | // must aliases the GEP, the end result is a must alias also. |
| 655 | if (GEP1BaseOffset == 0 && GEP1VariableIndices.empty()) |
Evan Cheng | 681a33e | 2009-10-14 06:41:49 +0000 | [diff] [blame] | 656 | return MustAlias; |
Evan Cheng | 094f04b | 2009-10-13 18:42:04 +0000 | [diff] [blame] | 657 | |
Chris Lattner | 4e91ee7 | 2009-11-26 02:13:03 +0000 | [diff] [blame] | 658 | // If we have a known constant offset, see if this offset is larger than the |
| 659 | // access size being queried. If so, and if no variable indices can remove |
| 660 | // pieces of this constant, then we know we have a no-alias. For example, |
| 661 | // &A[100] != &A. |
| 662 | |
| 663 | // In order to handle cases like &A[100][i] where i is an out of range |
| 664 | // subscript, we have to ignore all constant offset pieces that are a multiple |
| 665 | // of a scaled index. Do this by removing constant offsets that are a |
| 666 | // multiple of any of our variable indices. This allows us to transform |
| 667 | // things like &A[i][1] because i has a stride of (e.g.) 8 bytes but the 1 |
| 668 | // provides an offset of 4 bytes (assuming a <= 4 byte access). |
Chris Lattner | d84eb91 | 2009-11-26 02:17:34 +0000 | [diff] [blame] | 669 | for (unsigned i = 0, e = GEP1VariableIndices.size(); |
| 670 | i != e && GEP1BaseOffset;++i) |
| 671 | if (int64_t RemovedOffset = GEP1BaseOffset/GEP1VariableIndices[i].second) |
| 672 | GEP1BaseOffset -= RemovedOffset*GEP1VariableIndices[i].second; |
Chris Lattner | 4e91ee7 | 2009-11-26 02:13:03 +0000 | [diff] [blame] | 673 | |
| 674 | // If our known offset is bigger than the access size, we know we don't have |
| 675 | // an alias. |
| 676 | if (GEP1BaseOffset) { |
| 677 | if (GEP1BaseOffset >= (int64_t)V2Size || |
| 678 | GEP1BaseOffset <= -(int64_t)V1Size) |
Evan Cheng | 681a33e | 2009-10-14 06:41:49 +0000 | [diff] [blame] | 679 | return NoAlias; |
Evan Cheng | 094f04b | 2009-10-13 18:42:04 +0000 | [diff] [blame] | 680 | } |
Chris Lattner | 4e91ee7 | 2009-11-26 02:13:03 +0000 | [diff] [blame] | 681 | |
Evan Cheng | 094f04b | 2009-10-13 18:42:04 +0000 | [diff] [blame] | 682 | return MayAlias; |
| 683 | } |
| 684 | |
Chris Lattner | 5d56b2d | 2009-11-23 16:45:27 +0000 | [diff] [blame] | 685 | /// aliasSelect - Provide a bunch of ad-hoc rules to disambiguate a Select |
| 686 | /// instruction against another. |
Dan Gohman | 6665b0e | 2009-10-26 21:55:43 +0000 | [diff] [blame] | 687 | AliasAnalysis::AliasResult |
| 688 | BasicAliasAnalysis::aliasSelect(const SelectInst *SI, unsigned SISize, |
| 689 | const Value *V2, unsigned V2Size) { |
| 690 | // If the values are Selects with the same condition, we can do a more precise |
| 691 | // check: just check for aliases between the values on corresponding arms. |
| 692 | if (const SelectInst *SI2 = dyn_cast<SelectInst>(V2)) |
| 693 | if (SI->getCondition() == SI2->getCondition()) { |
| 694 | AliasResult Alias = |
| 695 | aliasCheck(SI->getTrueValue(), SISize, |
| 696 | SI2->getTrueValue(), V2Size); |
| 697 | if (Alias == MayAlias) |
| 698 | return MayAlias; |
| 699 | AliasResult ThisAlias = |
| 700 | aliasCheck(SI->getFalseValue(), SISize, |
| 701 | SI2->getFalseValue(), V2Size); |
| 702 | if (ThisAlias != Alias) |
| 703 | return MayAlias; |
| 704 | return Alias; |
| 705 | } |
| 706 | |
| 707 | // If both arms of the Select node NoAlias or MustAlias V2, then returns |
| 708 | // NoAlias / MustAlias. Otherwise, returns MayAlias. |
| 709 | AliasResult Alias = |
| 710 | aliasCheck(SI->getTrueValue(), SISize, V2, V2Size); |
| 711 | if (Alias == MayAlias) |
| 712 | return MayAlias; |
| 713 | AliasResult ThisAlias = |
| 714 | aliasCheck(SI->getFalseValue(), SISize, V2, V2Size); |
| 715 | if (ThisAlias != Alias) |
| 716 | return MayAlias; |
| 717 | return Alias; |
| 718 | } |
| 719 | |
Evan Cheng | d83c2ca | 2009-10-14 05:22:03 +0000 | [diff] [blame] | 720 | // aliasPHI - Provide a bunch of ad-hoc rules to disambiguate a PHI instruction |
Evan Cheng | 3dbe43b | 2009-10-14 05:05:02 +0000 | [diff] [blame] | 721 | // against another. |
Evan Cheng | 50a5914 | 2009-10-13 22:02:20 +0000 | [diff] [blame] | 722 | AliasAnalysis::AliasResult |
Evan Cheng | d83c2ca | 2009-10-14 05:22:03 +0000 | [diff] [blame] | 723 | BasicAliasAnalysis::aliasPHI(const PHINode *PN, unsigned PNSize, |
Evan Cheng | 3dbe43b | 2009-10-14 05:05:02 +0000 | [diff] [blame] | 724 | const Value *V2, unsigned V2Size) { |
Evan Cheng | 50a5914 | 2009-10-13 22:02:20 +0000 | [diff] [blame] | 725 | // The PHI node has already been visited, avoid recursion any further. |
Evan Cheng | d83c2ca | 2009-10-14 05:22:03 +0000 | [diff] [blame] | 726 | if (!VisitedPHIs.insert(PN)) |
Evan Cheng | 50a5914 | 2009-10-13 22:02:20 +0000 | [diff] [blame] | 727 | return MayAlias; |
| 728 | |
Dan Gohman | 6665b0e | 2009-10-26 21:55:43 +0000 | [diff] [blame] | 729 | // If the values are PHIs in the same block, we can do a more precise |
| 730 | // as well as efficient check: just check for aliases between the values |
| 731 | // on corresponding edges. |
| 732 | if (const PHINode *PN2 = dyn_cast<PHINode>(V2)) |
| 733 | if (PN2->getParent() == PN->getParent()) { |
| 734 | AliasResult Alias = |
| 735 | aliasCheck(PN->getIncomingValue(0), PNSize, |
| 736 | PN2->getIncomingValueForBlock(PN->getIncomingBlock(0)), |
| 737 | V2Size); |
| 738 | if (Alias == MayAlias) |
| 739 | return MayAlias; |
| 740 | for (unsigned i = 1, e = PN->getNumIncomingValues(); i != e; ++i) { |
| 741 | AliasResult ThisAlias = |
| 742 | aliasCheck(PN->getIncomingValue(i), PNSize, |
| 743 | PN2->getIncomingValueForBlock(PN->getIncomingBlock(i)), |
| 744 | V2Size); |
| 745 | if (ThisAlias != Alias) |
| 746 | return MayAlias; |
| 747 | } |
| 748 | return Alias; |
| 749 | } |
| 750 | |
Evan Cheng | a846a8a | 2009-10-16 00:33:09 +0000 | [diff] [blame] | 751 | SmallPtrSet<Value*, 4> UniqueSrc; |
Evan Cheng | 50a5914 | 2009-10-13 22:02:20 +0000 | [diff] [blame] | 752 | SmallVector<Value*, 4> V1Srcs; |
Evan Cheng | 50a5914 | 2009-10-13 22:02:20 +0000 | [diff] [blame] | 753 | for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) { |
| 754 | Value *PV1 = PN->getIncomingValue(i); |
| 755 | if (isa<PHINode>(PV1)) |
| 756 | // If any of the source itself is a PHI, return MayAlias conservatively |
Evan Cheng | 681a33e | 2009-10-14 06:41:49 +0000 | [diff] [blame] | 757 | // to avoid compile time explosion. The worst possible case is if both |
| 758 | // sides are PHI nodes. In which case, this is O(m x n) time where 'm' |
| 759 | // and 'n' are the number of PHI sources. |
Evan Cheng | 50a5914 | 2009-10-13 22:02:20 +0000 | [diff] [blame] | 760 | return MayAlias; |
| 761 | if (UniqueSrc.insert(PV1)) |
| 762 | V1Srcs.push_back(PV1); |
| 763 | } |
| 764 | |
Dan Gohman | 6665b0e | 2009-10-26 21:55:43 +0000 | [diff] [blame] | 765 | AliasResult Alias = aliasCheck(V2, V2Size, V1Srcs[0], PNSize); |
Evan Cheng | d83c2ca | 2009-10-14 05:22:03 +0000 | [diff] [blame] | 766 | // Early exit if the check of the first PHI source against V2 is MayAlias. |
| 767 | // Other results are not possible. |
| 768 | if (Alias == MayAlias) |
| 769 | return MayAlias; |
| 770 | |
Evan Cheng | 50a5914 | 2009-10-13 22:02:20 +0000 | [diff] [blame] | 771 | // If all sources of the PHI node NoAlias or MustAlias V2, then returns |
| 772 | // NoAlias / MustAlias. Otherwise, returns MayAlias. |
Evan Cheng | 50a5914 | 2009-10-13 22:02:20 +0000 | [diff] [blame] | 773 | for (unsigned i = 1, e = V1Srcs.size(); i != e; ++i) { |
| 774 | Value *V = V1Srcs[i]; |
Dan Gohman | 6665b0e | 2009-10-26 21:55:43 +0000 | [diff] [blame] | 775 | |
| 776 | // If V2 is a PHI, the recursive case will have been caught in the |
| 777 | // above aliasCheck call, so these subsequent calls to aliasCheck |
| 778 | // don't need to assume that V2 is being visited recursively. |
| 779 | VisitedPHIs.erase(V2); |
| 780 | |
Evan Cheng | a846a8a | 2009-10-16 00:33:09 +0000 | [diff] [blame] | 781 | AliasResult ThisAlias = aliasCheck(V2, V2Size, V, PNSize); |
Evan Cheng | d83c2ca | 2009-10-14 05:22:03 +0000 | [diff] [blame] | 782 | if (ThisAlias != Alias || ThisAlias == MayAlias) |
Evan Cheng | 50a5914 | 2009-10-13 22:02:20 +0000 | [diff] [blame] | 783 | return MayAlias; |
| 784 | } |
| 785 | |
| 786 | return Alias; |
| 787 | } |
| 788 | |
| 789 | // aliasCheck - Provide a bunch of ad-hoc rules to disambiguate in common cases, |
| 790 | // such as array references. |
Evan Cheng | 094f04b | 2009-10-13 18:42:04 +0000 | [diff] [blame] | 791 | // |
| 792 | AliasAnalysis::AliasResult |
Evan Cheng | 50a5914 | 2009-10-13 22:02:20 +0000 | [diff] [blame] | 793 | BasicAliasAnalysis::aliasCheck(const Value *V1, unsigned V1Size, |
Evan Cheng | 3dbe43b | 2009-10-14 05:05:02 +0000 | [diff] [blame] | 794 | const Value *V2, unsigned V2Size) { |
Evan Cheng | 094f04b | 2009-10-13 18:42:04 +0000 | [diff] [blame] | 795 | // Strip off any casts if they exist. |
| 796 | V1 = V1->stripPointerCasts(); |
| 797 | V2 = V2->stripPointerCasts(); |
| 798 | |
| 799 | // Are we checking for alias of the same value? |
| 800 | if (V1 == V2) return MustAlias; |
| 801 | |
| 802 | if (!isa<PointerType>(V1->getType()) || !isa<PointerType>(V2->getType())) |
| 803 | return NoAlias; // Scalars cannot alias each other |
| 804 | |
| 805 | // Figure out what objects these things are pointing to if we can. |
| 806 | const Value *O1 = V1->getUnderlyingObject(); |
| 807 | const Value *O2 = V2->getUnderlyingObject(); |
| 808 | |
Dan Gohman | f75ef66 | 2009-11-09 19:29:11 +0000 | [diff] [blame] | 809 | // Null values in the default address space don't point to any object, so they |
| 810 | // don't alias any other pointer. |
| 811 | if (const ConstantPointerNull *CPN = dyn_cast<ConstantPointerNull>(O1)) |
| 812 | if (CPN->getType()->getAddressSpace() == 0) |
| 813 | return NoAlias; |
| 814 | if (const ConstantPointerNull *CPN = dyn_cast<ConstantPointerNull>(O2)) |
| 815 | if (CPN->getType()->getAddressSpace() == 0) |
| 816 | return NoAlias; |
| 817 | |
Evan Cheng | 094f04b | 2009-10-13 18:42:04 +0000 | [diff] [blame] | 818 | if (O1 != O2) { |
| 819 | // If V1/V2 point to two different objects we know that we have no alias. |
| 820 | if (isIdentifiedObject(O1) && isIdentifiedObject(O2)) |
| 821 | return NoAlias; |
Nick Lewycky | 20162ac | 2009-11-14 06:15:14 +0000 | [diff] [blame] | 822 | |
| 823 | // Constant pointers can't alias with non-const isIdentifiedObject objects. |
| 824 | if ((isa<Constant>(O1) && isIdentifiedObject(O2) && !isa<Constant>(O2)) || |
| 825 | (isa<Constant>(O2) && isIdentifiedObject(O1) && !isa<Constant>(O1))) |
| 826 | return NoAlias; |
| 827 | |
Evan Cheng | 094f04b | 2009-10-13 18:42:04 +0000 | [diff] [blame] | 828 | // Arguments can't alias with local allocations or noalias calls. |
Victor Hernandez | 7b929da | 2009-10-23 21:09:37 +0000 | [diff] [blame] | 829 | if ((isa<Argument>(O1) && (isa<AllocaInst>(O2) || isNoAliasCall(O2))) || |
| 830 | (isa<Argument>(O2) && (isa<AllocaInst>(O1) || isNoAliasCall(O1)))) |
Evan Cheng | 094f04b | 2009-10-13 18:42:04 +0000 | [diff] [blame] | 831 | return NoAlias; |
| 832 | |
| 833 | // Most objects can't alias null. |
| 834 | if ((isa<ConstantPointerNull>(V2) && isKnownNonNull(O1)) || |
| 835 | (isa<ConstantPointerNull>(V1) && isKnownNonNull(O2))) |
| 836 | return NoAlias; |
| 837 | } |
| 838 | |
| 839 | // If the size of one access is larger than the entire object on the other |
| 840 | // side, then we know such behavior is undefined and can assume no alias. |
Evan Cheng | 094f04b | 2009-10-13 18:42:04 +0000 | [diff] [blame] | 841 | if (TD) |
Chris Lattner | 7b550cc | 2009-11-06 04:27:31 +0000 | [diff] [blame] | 842 | if ((V1Size != ~0U && isObjectSmallerThan(O2, V1Size, *TD)) || |
| 843 | (V2Size != ~0U && isObjectSmallerThan(O1, V2Size, *TD))) |
Evan Cheng | 094f04b | 2009-10-13 18:42:04 +0000 | [diff] [blame] | 844 | return NoAlias; |
| 845 | |
Dan Gohman | f94b5ed | 2009-11-19 21:57:48 +0000 | [diff] [blame] | 846 | // If one pointer is the result of a call/invoke or load and the other is a |
Evan Cheng | 094f04b | 2009-10-13 18:42:04 +0000 | [diff] [blame] | 847 | // non-escaping local object, then we know the object couldn't escape to a |
Dan Gohman | f94b5ed | 2009-11-19 21:57:48 +0000 | [diff] [blame] | 848 | // point where the call could return it. The load case works because |
| 849 | // isNonEscapingLocalObject considers all stores to be escapes (it |
| 850 | // passes true for the StoreCaptures argument to PointerMayBeCaptured). |
| 851 | if (O1 != O2) { |
Chris Lattner | 5d56b2d | 2009-11-23 16:45:27 +0000 | [diff] [blame] | 852 | if ((isa<CallInst>(O1) || isa<InvokeInst>(O1) || isa<LoadInst>(O1) || |
Chris Lattner | 403ac2e | 2009-11-23 16:46:41 +0000 | [diff] [blame] | 853 | isa<Argument>(O1)) && |
Dan Gohman | f94b5ed | 2009-11-19 21:57:48 +0000 | [diff] [blame] | 854 | isNonEscapingLocalObject(O2)) |
| 855 | return NoAlias; |
Chris Lattner | 5d56b2d | 2009-11-23 16:45:27 +0000 | [diff] [blame] | 856 | if ((isa<CallInst>(O2) || isa<InvokeInst>(O2) || isa<LoadInst>(O2) || |
Chris Lattner | 403ac2e | 2009-11-23 16:46:41 +0000 | [diff] [blame] | 857 | isa<Argument>(O2)) && |
Dan Gohman | f94b5ed | 2009-11-19 21:57:48 +0000 | [diff] [blame] | 858 | isNonEscapingLocalObject(O1)) |
| 859 | return NoAlias; |
| 860 | } |
Evan Cheng | 094f04b | 2009-10-13 18:42:04 +0000 | [diff] [blame] | 861 | |
Chris Lattner | 4e91ee7 | 2009-11-26 02:13:03 +0000 | [diff] [blame] | 862 | // FIXME: This isn't aggressively handling alias(GEP, PHI) for example: if the |
| 863 | // GEP can't simplify, we don't even look at the PHI cases. |
Chris Lattner | 391d23b | 2009-10-17 23:48:54 +0000 | [diff] [blame] | 864 | if (!isa<GEPOperator>(V1) && isa<GEPOperator>(V2)) { |
Chris Lattner | d501c13 | 2003-02-26 19:41:54 +0000 | [diff] [blame] | 865 | std::swap(V1, V2); |
| 866 | std::swap(V1Size, V2Size); |
Chris Lattner | 23e2a5b | 2009-11-26 02:14:59 +0000 | [diff] [blame] | 867 | std::swap(O1, O2); |
Chris Lattner | d501c13 | 2003-02-26 19:41:54 +0000 | [diff] [blame] | 868 | } |
Chris Lattner | 539c9b9 | 2009-11-26 02:11:08 +0000 | [diff] [blame] | 869 | if (const GEPOperator *GV1 = dyn_cast<GEPOperator>(V1)) |
Chris Lattner | 23e2a5b | 2009-11-26 02:14:59 +0000 | [diff] [blame] | 870 | return aliasGEP(GV1, V1Size, V2, V2Size, O1, O2); |
Evan Cheng | 50a5914 | 2009-10-13 22:02:20 +0000 | [diff] [blame] | 871 | |
| 872 | if (isa<PHINode>(V2) && !isa<PHINode>(V1)) { |
| 873 | std::swap(V1, V2); |
| 874 | std::swap(V1Size, V2Size); |
| 875 | } |
Evan Cheng | d83c2ca | 2009-10-14 05:22:03 +0000 | [diff] [blame] | 876 | if (const PHINode *PN = dyn_cast<PHINode>(V1)) |
| 877 | return aliasPHI(PN, V1Size, V2, V2Size); |
Misha Brukman | 2b37d7c | 2005-04-21 21:13:18 +0000 | [diff] [blame] | 878 | |
Dan Gohman | 6665b0e | 2009-10-26 21:55:43 +0000 | [diff] [blame] | 879 | if (isa<SelectInst>(V2) && !isa<SelectInst>(V1)) { |
| 880 | std::swap(V1, V2); |
| 881 | std::swap(V1Size, V2Size); |
| 882 | } |
| 883 | if (const SelectInst *S1 = dyn_cast<SelectInst>(V1)) |
| 884 | return aliasSelect(S1, V1Size, V2, V2Size); |
| 885 | |
Chris Lattner | d501c13 | 2003-02-26 19:41:54 +0000 | [diff] [blame] | 886 | return MayAlias; |
| 887 | } |
| 888 | |
Chris Lattner | 5d56b2d | 2009-11-23 16:45:27 +0000 | [diff] [blame] | 889 | // Make sure that anything that uses AliasAnalysis pulls in this file. |
Reid Spencer | 4f1bd9e | 2006-06-07 22:00:26 +0000 | [diff] [blame] | 890 | DEFINING_FILE_FOR(BasicAliasAnalysis) |