Chris Lattner | 7d58f8d | 2002-08-22 18:25:32 +0000 | [diff] [blame] | 1 | //===- AliasAnalysis.cpp - Generic Alias Analysis Interface Implementation -==// |
Misha Brukman | 01808ca | 2005-04-21 21:13:18 +0000 | [diff] [blame] | 2 | // |
John Criswell | 482202a | 2003-10-20 19:43:21 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | f3ebc3f | 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 | 01808ca | 2005-04-21 21:13:18 +0000 | [diff] [blame] | 7 | // |
John Criswell | 482202a | 2003-10-20 19:43:21 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
Chris Lattner | 7d58f8d | 2002-08-22 18:25:32 +0000 | [diff] [blame] | 9 | // |
| 10 | // This file implements the generic AliasAnalysis interface which is used as the |
| 11 | // common interface used by all clients and implementations of alias analysis. |
| 12 | // |
| 13 | // This file also implements the default version of the AliasAnalysis interface |
| 14 | // that is to be used when no other implementation is specified. This does some |
| 15 | // simple tests that detect obvious cases: two different global pointers cannot |
| 16 | // alias, a global cannot alias a malloc, two different mallocs cannot alias, |
| 17 | // etc. |
| 18 | // |
| 19 | // This alias analysis implementation really isn't very good for anything, but |
| 20 | // it is very fast, and makes a nice clean default implementation. Because it |
| 21 | // handles lots of little corner cases, other, more complex, alias analysis |
| 22 | // implementations may choose to rely on this pass to resolve these simple and |
| 23 | // easy cases. |
| 24 | // |
| 25 | //===----------------------------------------------------------------------===// |
| 26 | |
Chris Lattner | d6a2a99 | 2003-02-26 19:41:54 +0000 | [diff] [blame] | 27 | #include "llvm/Analysis/AliasAnalysis.h" |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 28 | #include "llvm/Analysis/BasicAliasAnalysis.h" |
Nick Lewycky | 0b68245 | 2013-07-27 01:24:00 +0000 | [diff] [blame] | 29 | #include "llvm/Analysis/CFG.h" |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 30 | #include "llvm/Analysis/CFLAliasAnalysis.h" |
Chandler Carruth | 8a8cd2b | 2014-01-07 11:48:04 +0000 | [diff] [blame] | 31 | #include "llvm/Analysis/CaptureTracking.h" |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 32 | #include "llvm/Analysis/GlobalsModRef.h" |
| 33 | #include "llvm/Analysis/ObjCARCAliasAnalysis.h" |
| 34 | #include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h" |
| 35 | #include "llvm/Analysis/ScopedNoAliasAA.h" |
Chandler Carruth | 62d4215 | 2015-01-15 02:16:27 +0000 | [diff] [blame] | 36 | #include "llvm/Analysis/TargetLibraryInfo.h" |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 37 | #include "llvm/Analysis/TypeBasedAliasAnalysis.h" |
Chad Rosier | a968caf | 2012-05-14 20:35:04 +0000 | [diff] [blame] | 38 | #include "llvm/Analysis/ValueTracking.h" |
Chandler Carruth | 9fb823b | 2013-01-02 11:36:10 +0000 | [diff] [blame] | 39 | #include "llvm/IR/BasicBlock.h" |
| 40 | #include "llvm/IR/DataLayout.h" |
Chandler Carruth | 5ad5f15 | 2014-01-13 09:26:24 +0000 | [diff] [blame] | 41 | #include "llvm/IR/Dominators.h" |
Chandler Carruth | 9fb823b | 2013-01-02 11:36:10 +0000 | [diff] [blame] | 42 | #include "llvm/IR/Function.h" |
| 43 | #include "llvm/IR/Instructions.h" |
| 44 | #include "llvm/IR/IntrinsicInst.h" |
| 45 | #include "llvm/IR/LLVMContext.h" |
| 46 | #include "llvm/IR/Type.h" |
Chandler Carruth | ed0881b | 2012-12-03 16:50:05 +0000 | [diff] [blame] | 47 | #include "llvm/Pass.h" |
Chris Lattner | a67dbd0 | 2004-03-15 04:07:29 +0000 | [diff] [blame] | 48 | using namespace llvm; |
Brian Gaeke | 960707c | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 49 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 50 | /// Allow disabling BasicAA from the AA results. This is particularly useful |
| 51 | /// when testing to isolate a single AA implementation. |
| 52 | static cl::opt<bool> DisableBasicAA("disable-basicaa", cl::Hidden, |
| 53 | cl::init(false)); |
| 54 | |
| 55 | AAResults::AAResults(AAResults &&Arg) : AAs(std::move(Arg.AAs)) { |
| 56 | for (auto &AA : AAs) |
| 57 | AA->setAAResults(this); |
| 58 | } |
| 59 | |
| 60 | AAResults &AAResults::operator=(AAResults &&Arg) { |
| 61 | AAs = std::move(Arg.AAs); |
| 62 | for (auto &AA : AAs) |
| 63 | AA->setAAResults(this); |
| 64 | return *this; |
| 65 | } |
| 66 | |
| 67 | AAResults::~AAResults() { |
| 68 | // FIXME; It would be nice to at least clear out the pointers back to this |
| 69 | // aggregation here, but we end up with non-nesting lifetimes in the legacy |
| 70 | // pass manager that prevent this from working. In the legacy pass manager |
| 71 | // we'll end up with dangling references here in some cases. |
| 72 | #if 0 |
| 73 | for (auto &AA : AAs) |
| 74 | AA->setAAResults(nullptr); |
| 75 | #endif |
| 76 | } |
Chris Lattner | 7d58f8d | 2002-08-22 18:25:32 +0000 | [diff] [blame] | 77 | |
Chris Lattner | 62c3700 | 2004-05-23 21:15:48 +0000 | [diff] [blame] | 78 | //===----------------------------------------------------------------------===// |
| 79 | // Default chaining methods |
| 80 | //===----------------------------------------------------------------------===// |
| 81 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 82 | AliasResult AAResults::alias(const MemoryLocation &LocA, |
| 83 | const MemoryLocation &LocB) { |
| 84 | for (const auto &AA : AAs) { |
| 85 | auto Result = AA->alias(LocA, LocB); |
| 86 | if (Result != MayAlias) |
| 87 | return Result; |
| 88 | } |
| 89 | return MayAlias; |
Chris Lattner | 62c3700 | 2004-05-23 21:15:48 +0000 | [diff] [blame] | 90 | } |
| 91 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 92 | bool AAResults::pointsToConstantMemory(const MemoryLocation &Loc, |
| 93 | bool OrLocal) { |
| 94 | for (const auto &AA : AAs) |
| 95 | if (AA->pointsToConstantMemory(Loc, OrLocal)) |
| 96 | return true; |
| 97 | |
| 98 | return false; |
Chris Lattner | 62c3700 | 2004-05-23 21:15:48 +0000 | [diff] [blame] | 99 | } |
| 100 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 101 | ModRefInfo AAResults::getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) { |
| 102 | ModRefInfo Result = MRI_ModRef; |
| 103 | |
| 104 | for (const auto &AA : AAs) { |
| 105 | Result = ModRefInfo(Result & AA->getArgModRefInfo(CS, ArgIdx)); |
| 106 | |
| 107 | // Early-exit the moment we reach the bottom of the lattice. |
| 108 | if (Result == MRI_NoModRef) |
| 109 | return Result; |
| 110 | } |
| 111 | |
| 112 | return Result; |
Hal Finkel | 354e23b | 2014-07-17 01:28:25 +0000 | [diff] [blame] | 113 | } |
| 114 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 115 | ModRefInfo AAResults::getModRefInfo(Instruction *I, ImmutableCallSite Call) { |
Daniel Berlin | 8de312d | 2015-04-13 23:25:41 +0000 | [diff] [blame] | 116 | // We may have two calls |
| 117 | if (auto CS = ImmutableCallSite(I)) { |
| 118 | // Check if the two calls modify the same memory |
| 119 | return getModRefInfo(Call, CS); |
| 120 | } else { |
| 121 | // Otherwise, check if the call modifies or references the |
| 122 | // location this memory access defines. The best we can say |
| 123 | // is that if the call references what this instruction |
| 124 | // defines, it must be clobbered by this location. |
Chandler Carruth | ac80dc7 | 2015-06-17 07:18:54 +0000 | [diff] [blame] | 125 | const MemoryLocation DefLoc = MemoryLocation::get(I); |
Chandler Carruth | 194f59c | 2015-07-22 23:15:57 +0000 | [diff] [blame] | 126 | if (getModRefInfo(Call, DefLoc) != MRI_NoModRef) |
| 127 | return MRI_ModRef; |
Daniel Berlin | 8de312d | 2015-04-13 23:25:41 +0000 | [diff] [blame] | 128 | } |
Chandler Carruth | 194f59c | 2015-07-22 23:15:57 +0000 | [diff] [blame] | 129 | return MRI_NoModRef; |
Daniel Berlin | 8de312d | 2015-04-13 23:25:41 +0000 | [diff] [blame] | 130 | } |
Owen Anderson | b6e4ff0 | 2011-01-03 21:38:41 +0000 | [diff] [blame] | 131 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 132 | ModRefInfo AAResults::getModRefInfo(ImmutableCallSite CS, |
| 133 | const MemoryLocation &Loc) { |
| 134 | ModRefInfo Result = MRI_ModRef; |
Dan Gohman | 5f1702e | 2010-08-06 01:25:49 +0000 | [diff] [blame] | 135 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 136 | for (const auto &AA : AAs) { |
| 137 | Result = ModRefInfo(Result & AA->getModRefInfo(CS, Loc)); |
Dan Gohman | 5f1702e | 2010-08-06 01:25:49 +0000 | [diff] [blame] | 138 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 139 | // Early-exit the moment we reach the bottom of the lattice. |
| 140 | if (Result == MRI_NoModRef) |
| 141 | return Result; |
Dan Gohman | 5f1702e | 2010-08-06 01:25:49 +0000 | [diff] [blame] | 142 | } |
| 143 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 144 | return Result; |
Dan Gohman | 5f1702e | 2010-08-06 01:25:49 +0000 | [diff] [blame] | 145 | } |
| 146 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 147 | ModRefInfo AAResults::getModRefInfo(ImmutableCallSite CS1, |
| 148 | ImmutableCallSite CS2) { |
| 149 | ModRefInfo Result = MRI_ModRef; |
Dan Gohman | 5f1702e | 2010-08-06 01:25:49 +0000 | [diff] [blame] | 150 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 151 | for (const auto &AA : AAs) { |
| 152 | Result = ModRefInfo(Result & AA->getModRefInfo(CS1, CS2)); |
Dan Gohman | 5f1702e | 2010-08-06 01:25:49 +0000 | [diff] [blame] | 153 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 154 | // Early-exit the moment we reach the bottom of the lattice. |
| 155 | if (Result == MRI_NoModRef) |
| 156 | return Result; |
Dan Gohman | 5f1702e | 2010-08-06 01:25:49 +0000 | [diff] [blame] | 157 | } |
| 158 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 159 | return Result; |
| 160 | } |
Chandler Carruth | c41404a | 2015-06-17 07:12:40 +0000 | [diff] [blame] | 161 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 162 | FunctionModRefBehavior AAResults::getModRefBehavior(ImmutableCallSite CS) { |
| 163 | FunctionModRefBehavior Result = FMRB_UnknownModRefBehavior; |
Hal Finkel | 354e23b | 2014-07-17 01:28:25 +0000 | [diff] [blame] | 164 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 165 | for (const auto &AA : AAs) { |
| 166 | Result = FunctionModRefBehavior(Result & AA->getModRefBehavior(CS)); |
| 167 | |
| 168 | // Early-exit the moment we reach the bottom of the lattice. |
| 169 | if (Result == FMRB_DoesNotAccessMemory) |
| 170 | return Result; |
Dan Gohman | 5f1702e | 2010-08-06 01:25:49 +0000 | [diff] [blame] | 171 | } |
| 172 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 173 | return Result; |
Dan Gohman | 5f1702e | 2010-08-06 01:25:49 +0000 | [diff] [blame] | 174 | } |
| 175 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 176 | FunctionModRefBehavior AAResults::getModRefBehavior(const Function *F) { |
| 177 | FunctionModRefBehavior Result = FMRB_UnknownModRefBehavior; |
Dan Gohman | 5f1702e | 2010-08-06 01:25:49 +0000 | [diff] [blame] | 178 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 179 | for (const auto &AA : AAs) { |
| 180 | Result = FunctionModRefBehavior(Result & AA->getModRefBehavior(F)); |
Dan Gohman | 5f1702e | 2010-08-06 01:25:49 +0000 | [diff] [blame] | 181 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 182 | // Early-exit the moment we reach the bottom of the lattice. |
| 183 | if (Result == FMRB_DoesNotAccessMemory) |
| 184 | return Result; |
| 185 | } |
Dan Gohman | 5f1702e | 2010-08-06 01:25:49 +0000 | [diff] [blame] | 186 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 187 | return Result; |
Chris Lattner | 62c3700 | 2004-05-23 21:15:48 +0000 | [diff] [blame] | 188 | } |
| 189 | |
Chris Lattner | 62c3700 | 2004-05-23 21:15:48 +0000 | [diff] [blame] | 190 | //===----------------------------------------------------------------------===// |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 191 | // Helper method implementation |
Chris Lattner | 62c3700 | 2004-05-23 21:15:48 +0000 | [diff] [blame] | 192 | //===----------------------------------------------------------------------===// |
| 193 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 194 | ModRefInfo AAResults::getModRefInfo(const LoadInst *L, |
| 195 | const MemoryLocation &Loc) { |
Eli Friedman | 5494ada | 2011-08-15 20:54:19 +0000 | [diff] [blame] | 196 | // Be conservative in the face of volatile/atomic. |
| 197 | if (!L->isUnordered()) |
Chandler Carruth | 194f59c | 2015-07-22 23:15:57 +0000 | [diff] [blame] | 198 | return MRI_ModRef; |
Dan Gohman | 6b4671b | 2010-08-06 18:11:28 +0000 | [diff] [blame] | 199 | |
Dan Gohman | 52f9d7d | 2010-08-03 17:27:43 +0000 | [diff] [blame] | 200 | // If the load address doesn't alias the given address, it doesn't read |
| 201 | // or write the specified memory. |
Chandler Carruth | 70c61c1 | 2015-06-04 02:03:15 +0000 | [diff] [blame] | 202 | if (Loc.Ptr && !alias(MemoryLocation::get(L), Loc)) |
Chandler Carruth | 194f59c | 2015-07-22 23:15:57 +0000 | [diff] [blame] | 203 | return MRI_NoModRef; |
Dan Gohman | 52f9d7d | 2010-08-03 17:27:43 +0000 | [diff] [blame] | 204 | |
Dan Gohman | 52f9d7d | 2010-08-03 17:27:43 +0000 | [diff] [blame] | 205 | // Otherwise, a load just reads. |
Chandler Carruth | 194f59c | 2015-07-22 23:15:57 +0000 | [diff] [blame] | 206 | return MRI_Ref; |
Chris Lattner | 7d58f8d | 2002-08-22 18:25:32 +0000 | [diff] [blame] | 207 | } |
| 208 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 209 | ModRefInfo AAResults::getModRefInfo(const StoreInst *S, |
| 210 | const MemoryLocation &Loc) { |
Eli Friedman | 5494ada | 2011-08-15 20:54:19 +0000 | [diff] [blame] | 211 | // Be conservative in the face of volatile/atomic. |
| 212 | if (!S->isUnordered()) |
Chandler Carruth | 194f59c | 2015-07-22 23:15:57 +0000 | [diff] [blame] | 213 | return MRI_ModRef; |
Dan Gohman | 6b4671b | 2010-08-06 18:11:28 +0000 | [diff] [blame] | 214 | |
Daniel Berlin | b2d2276 | 2015-04-13 23:05:45 +0000 | [diff] [blame] | 215 | if (Loc.Ptr) { |
| 216 | // If the store address cannot alias the pointer in question, then the |
| 217 | // specified memory cannot be modified by the store. |
Chandler Carruth | 70c61c1 | 2015-06-04 02:03:15 +0000 | [diff] [blame] | 218 | if (!alias(MemoryLocation::get(S), Loc)) |
Chandler Carruth | 194f59c | 2015-07-22 23:15:57 +0000 | [diff] [blame] | 219 | return MRI_NoModRef; |
Chris Lattner | 9605576 | 2004-01-30 22:16:42 +0000 | [diff] [blame] | 220 | |
Daniel Berlin | b2d2276 | 2015-04-13 23:05:45 +0000 | [diff] [blame] | 221 | // If the pointer is a pointer to constant memory, then it could not have |
| 222 | // been modified by this store. |
| 223 | if (pointsToConstantMemory(Loc)) |
Chandler Carruth | 194f59c | 2015-07-22 23:15:57 +0000 | [diff] [blame] | 224 | return MRI_NoModRef; |
Daniel Berlin | b2d2276 | 2015-04-13 23:05:45 +0000 | [diff] [blame] | 225 | } |
Dan Gohman | 52f9d7d | 2010-08-03 17:27:43 +0000 | [diff] [blame] | 226 | |
| 227 | // Otherwise, a store just writes. |
Chandler Carruth | 194f59c | 2015-07-22 23:15:57 +0000 | [diff] [blame] | 228 | return MRI_Mod; |
Chris Lattner | 3a31183 | 2003-02-26 19:26:51 +0000 | [diff] [blame] | 229 | } |
| 230 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 231 | ModRefInfo AAResults::getModRefInfo(const VAArgInst *V, |
| 232 | const MemoryLocation &Loc) { |
Dan Gohman | e68958f | 2010-08-06 18:24:38 +0000 | [diff] [blame] | 233 | |
Daniel Berlin | ec1de3f | 2015-04-28 19:19:14 +0000 | [diff] [blame] | 234 | if (Loc.Ptr) { |
| 235 | // If the va_arg address cannot alias the pointer in question, then the |
| 236 | // specified memory cannot be accessed by the va_arg. |
Chandler Carruth | 70c61c1 | 2015-06-04 02:03:15 +0000 | [diff] [blame] | 237 | if (!alias(MemoryLocation::get(V), Loc)) |
Chandler Carruth | 194f59c | 2015-07-22 23:15:57 +0000 | [diff] [blame] | 238 | return MRI_NoModRef; |
Daniel Berlin | ec1de3f | 2015-04-28 19:19:14 +0000 | [diff] [blame] | 239 | |
| 240 | // If the pointer is a pointer to constant memory, then it could not have |
| 241 | // been modified by this va_arg. |
| 242 | if (pointsToConstantMemory(Loc)) |
Chandler Carruth | 194f59c | 2015-07-22 23:15:57 +0000 | [diff] [blame] | 243 | return MRI_NoModRef; |
Daniel Berlin | ec1de3f | 2015-04-28 19:19:14 +0000 | [diff] [blame] | 244 | } |
Dan Gohman | e68958f | 2010-08-06 18:24:38 +0000 | [diff] [blame] | 245 | |
| 246 | // Otherwise, a va_arg reads and writes. |
Chandler Carruth | 194f59c | 2015-07-22 23:15:57 +0000 | [diff] [blame] | 247 | return MRI_ModRef; |
Dan Gohman | e68958f | 2010-08-06 18:24:38 +0000 | [diff] [blame] | 248 | } |
| 249 | |
David Majnemer | 6727c01 | 2015-11-17 08:15:14 +0000 | [diff] [blame] | 250 | ModRefInfo AAResults::getModRefInfo(const CatchPadInst *CatchPad, |
| 251 | const MemoryLocation &Loc) { |
| 252 | if (Loc.Ptr) { |
| 253 | // If the pointer is a pointer to constant memory, |
| 254 | // then it could not have been modified by this catchpad. |
| 255 | if (pointsToConstantMemory(Loc)) |
| 256 | return MRI_NoModRef; |
| 257 | } |
| 258 | |
| 259 | // Otherwise, a catchpad reads and writes. |
| 260 | return MRI_ModRef; |
| 261 | } |
| 262 | |
| 263 | ModRefInfo AAResults::getModRefInfo(const CatchReturnInst *CatchRet, |
| 264 | const MemoryLocation &Loc) { |
| 265 | if (Loc.Ptr) { |
| 266 | // If the pointer is a pointer to constant memory, |
| 267 | // then it could not have been modified by this catchpad. |
| 268 | if (pointsToConstantMemory(Loc)) |
| 269 | return MRI_NoModRef; |
| 270 | } |
| 271 | |
| 272 | // Otherwise, a catchret reads and writes. |
| 273 | return MRI_ModRef; |
| 274 | } |
| 275 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 276 | ModRefInfo AAResults::getModRefInfo(const AtomicCmpXchgInst *CX, |
| 277 | const MemoryLocation &Loc) { |
Eli Friedman | 5c91891 | 2011-09-26 20:15:28 +0000 | [diff] [blame] | 278 | // Acquire/Release cmpxchg has properties that matter for arbitrary addresses. |
Tim Northover | e94a518 | 2014-03-11 10:48:52 +0000 | [diff] [blame] | 279 | if (CX->getSuccessOrdering() > Monotonic) |
Chandler Carruth | 194f59c | 2015-07-22 23:15:57 +0000 | [diff] [blame] | 280 | return MRI_ModRef; |
Eli Friedman | 5c91891 | 2011-09-26 20:15:28 +0000 | [diff] [blame] | 281 | |
| 282 | // If the cmpxchg address does not alias the location, it does not access it. |
Chandler Carruth | 70c61c1 | 2015-06-04 02:03:15 +0000 | [diff] [blame] | 283 | if (Loc.Ptr && !alias(MemoryLocation::get(CX), Loc)) |
Chandler Carruth | 194f59c | 2015-07-22 23:15:57 +0000 | [diff] [blame] | 284 | return MRI_NoModRef; |
Eli Friedman | 5c91891 | 2011-09-26 20:15:28 +0000 | [diff] [blame] | 285 | |
Chandler Carruth | 194f59c | 2015-07-22 23:15:57 +0000 | [diff] [blame] | 286 | return MRI_ModRef; |
Eli Friedman | 5c91891 | 2011-09-26 20:15:28 +0000 | [diff] [blame] | 287 | } |
| 288 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 289 | ModRefInfo AAResults::getModRefInfo(const AtomicRMWInst *RMW, |
| 290 | const MemoryLocation &Loc) { |
Eli Friedman | 5c91891 | 2011-09-26 20:15:28 +0000 | [diff] [blame] | 291 | // Acquire/Release atomicrmw has properties that matter for arbitrary addresses. |
| 292 | if (RMW->getOrdering() > Monotonic) |
Chandler Carruth | 194f59c | 2015-07-22 23:15:57 +0000 | [diff] [blame] | 293 | return MRI_ModRef; |
Eli Friedman | 5c91891 | 2011-09-26 20:15:28 +0000 | [diff] [blame] | 294 | |
| 295 | // If the atomicrmw address does not alias the location, it does not access it. |
Chandler Carruth | 70c61c1 | 2015-06-04 02:03:15 +0000 | [diff] [blame] | 296 | if (Loc.Ptr && !alias(MemoryLocation::get(RMW), Loc)) |
Chandler Carruth | 194f59c | 2015-07-22 23:15:57 +0000 | [diff] [blame] | 297 | return MRI_NoModRef; |
Eli Friedman | 5c91891 | 2011-09-26 20:15:28 +0000 | [diff] [blame] | 298 | |
Chandler Carruth | 194f59c | 2015-07-22 23:15:57 +0000 | [diff] [blame] | 299 | return MRI_ModRef; |
Eli Friedman | 5c91891 | 2011-09-26 20:15:28 +0000 | [diff] [blame] | 300 | } |
| 301 | |
Bruno Cardoso Lopes | dfc1d96 | 2015-07-31 14:31:35 +0000 | [diff] [blame] | 302 | /// \brief Return information about whether a particular call site modifies |
| 303 | /// or reads the specified memory location \p MemLoc before instruction \p I |
| 304 | /// in a BasicBlock. A ordered basic block \p OBB can be used to speed up |
| 305 | /// instruction-ordering queries inside the BasicBlock containing \p I. |
| 306 | /// FIXME: this is really just shoring-up a deficiency in alias analysis. |
| 307 | /// BasicAA isn't willing to spend linear time determining whether an alloca |
| 308 | /// was captured before or after this particular call, while we are. However, |
| 309 | /// with a smarter AA in place, this test is just wasting compile time. |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 310 | ModRefInfo AAResults::callCapturesBefore(const Instruction *I, |
| 311 | const MemoryLocation &MemLoc, |
| 312 | DominatorTree *DT, |
| 313 | OrderedBasicBlock *OBB) { |
Mehdi Amini | a28d91d | 2015-03-10 02:37:25 +0000 | [diff] [blame] | 314 | if (!DT) |
Chandler Carruth | 194f59c | 2015-07-22 23:15:57 +0000 | [diff] [blame] | 315 | return MRI_ModRef; |
Chad Rosier | a968caf | 2012-05-14 20:35:04 +0000 | [diff] [blame] | 316 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 317 | const Value *Object = |
| 318 | GetUnderlyingObject(MemLoc.Ptr, I->getModule()->getDataLayout()); |
Chad Rosier | a968caf | 2012-05-14 20:35:04 +0000 | [diff] [blame] | 319 | if (!isIdentifiedObject(Object) || isa<GlobalValue>(Object) || |
| 320 | isa<Constant>(Object)) |
Chandler Carruth | 194f59c | 2015-07-22 23:15:57 +0000 | [diff] [blame] | 321 | return MRI_ModRef; |
Chad Rosier | a968caf | 2012-05-14 20:35:04 +0000 | [diff] [blame] | 322 | |
| 323 | ImmutableCallSite CS(I); |
| 324 | if (!CS.getInstruction() || CS.getInstruction() == Object) |
Chandler Carruth | 194f59c | 2015-07-22 23:15:57 +0000 | [diff] [blame] | 325 | return MRI_ModRef; |
Chad Rosier | a968caf | 2012-05-14 20:35:04 +0000 | [diff] [blame] | 326 | |
Hal Finkel | b035621 | 2014-07-21 13:15:48 +0000 | [diff] [blame] | 327 | if (llvm::PointerMayBeCapturedBefore(Object, /* ReturnCaptures */ true, |
Hal Finkel | d32803b | 2014-07-21 21:30:22 +0000 | [diff] [blame] | 328 | /* StoreCaptures */ true, I, DT, |
Bruno Cardoso Lopes | dfc1d96 | 2015-07-31 14:31:35 +0000 | [diff] [blame] | 329 | /* include Object */ true, |
| 330 | /* OrderedBasicBlock */ OBB)) |
Chandler Carruth | 194f59c | 2015-07-22 23:15:57 +0000 | [diff] [blame] | 331 | return MRI_ModRef; |
Chad Rosier | a968caf | 2012-05-14 20:35:04 +0000 | [diff] [blame] | 332 | |
| 333 | unsigned ArgNo = 0; |
Chandler Carruth | 194f59c | 2015-07-22 23:15:57 +0000 | [diff] [blame] | 334 | ModRefInfo R = MRI_NoModRef; |
Chad Rosier | a968caf | 2012-05-14 20:35:04 +0000 | [diff] [blame] | 335 | for (ImmutableCallSite::arg_iterator CI = CS.arg_begin(), CE = CS.arg_end(); |
| 336 | CI != CE; ++CI, ++ArgNo) { |
| 337 | // Only look at the no-capture or byval pointer arguments. If this |
| 338 | // pointer were passed to arguments that were neither of these, then it |
| 339 | // couldn't be no-capture. |
| 340 | if (!(*CI)->getType()->isPointerTy() || |
| 341 | (!CS.doesNotCapture(ArgNo) && !CS.isByValArgument(ArgNo))) |
| 342 | continue; |
| 343 | |
| 344 | // If this is a no-capture pointer argument, see if we can tell that it |
| 345 | // is impossible to alias the pointer we're checking. If not, we have to |
| 346 | // assume that the call could touch the pointer, even though it doesn't |
| 347 | // escape. |
Chandler Carruth | ac80dc7 | 2015-06-17 07:18:54 +0000 | [diff] [blame] | 348 | if (isNoAlias(MemoryLocation(*CI), MemoryLocation(Object))) |
Nick Lewycky | c051462 | 2013-07-07 10:15:16 +0000 | [diff] [blame] | 349 | continue; |
| 350 | if (CS.doesNotAccessMemory(ArgNo)) |
| 351 | continue; |
| 352 | if (CS.onlyReadsMemory(ArgNo)) { |
Chandler Carruth | 194f59c | 2015-07-22 23:15:57 +0000 | [diff] [blame] | 353 | R = MRI_Ref; |
Nick Lewycky | c051462 | 2013-07-07 10:15:16 +0000 | [diff] [blame] | 354 | continue; |
Chad Rosier | a968caf | 2012-05-14 20:35:04 +0000 | [diff] [blame] | 355 | } |
Chandler Carruth | 194f59c | 2015-07-22 23:15:57 +0000 | [diff] [blame] | 356 | return MRI_ModRef; |
Chad Rosier | a968caf | 2012-05-14 20:35:04 +0000 | [diff] [blame] | 357 | } |
Nick Lewycky | c051462 | 2013-07-07 10:15:16 +0000 | [diff] [blame] | 358 | return R; |
Chad Rosier | a968caf | 2012-05-14 20:35:04 +0000 | [diff] [blame] | 359 | } |
Eli Friedman | 5c91891 | 2011-09-26 20:15:28 +0000 | [diff] [blame] | 360 | |
Chris Lattner | d922a84 | 2002-08-22 22:46:39 +0000 | [diff] [blame] | 361 | /// canBasicBlockModify - Return true if it is possible for execution of the |
Elena Demikhovsky | a5599bf | 2014-12-15 14:09:53 +0000 | [diff] [blame] | 362 | /// specified basic block to modify the location Loc. |
Chris Lattner | d922a84 | 2002-08-22 22:46:39 +0000 | [diff] [blame] | 363 | /// |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 364 | bool AAResults::canBasicBlockModify(const BasicBlock &BB, |
| 365 | const MemoryLocation &Loc) { |
Chandler Carruth | 194f59c | 2015-07-22 23:15:57 +0000 | [diff] [blame] | 366 | return canInstructionRangeModRef(BB.front(), BB.back(), Loc, MRI_Mod); |
Chris Lattner | 7d58f8d | 2002-08-22 18:25:32 +0000 | [diff] [blame] | 367 | } |
| 368 | |
Elena Demikhovsky | a5599bf | 2014-12-15 14:09:53 +0000 | [diff] [blame] | 369 | /// canInstructionRangeModRef - Return true if it is possible for the |
| 370 | /// execution of the specified instructions to mod\ref (according to the |
| 371 | /// mode) the location Loc. The instructions to consider are all |
| 372 | /// of the instructions in the range of [I1,I2] INCLUSIVE. |
Teresa Johnson | bbcf75e | 2015-05-13 15:04:14 +0000 | [diff] [blame] | 373 | /// I1 and I2 must be in the same basic block. |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 374 | bool AAResults::canInstructionRangeModRef(const Instruction &I1, |
| 375 | const Instruction &I2, |
| 376 | const MemoryLocation &Loc, |
| 377 | const ModRefInfo Mode) { |
Chris Lattner | 7d58f8d | 2002-08-22 18:25:32 +0000 | [diff] [blame] | 378 | assert(I1.getParent() == I2.getParent() && |
| 379 | "Instructions not in same basic block!"); |
Duncan P. N. Exon Smith | 5a82c91 | 2015-10-10 00:53:03 +0000 | [diff] [blame] | 380 | BasicBlock::const_iterator I = I1.getIterator(); |
| 381 | BasicBlock::const_iterator E = I2.getIterator(); |
Chris Lattner | 7d58f8d | 2002-08-22 18:25:32 +0000 | [diff] [blame] | 382 | ++E; // Convert from inclusive to exclusive range. |
| 383 | |
Chris Lattner | 3a31183 | 2003-02-26 19:26:51 +0000 | [diff] [blame] | 384 | for (; I != E; ++I) // Check every instruction in range |
Duncan P. N. Exon Smith | 5a82c91 | 2015-10-10 00:53:03 +0000 | [diff] [blame] | 385 | if (getModRefInfo(&*I, Loc) & Mode) |
Chris Lattner | 7d58f8d | 2002-08-22 18:25:32 +0000 | [diff] [blame] | 386 | return true; |
Chris Lattner | 7d58f8d | 2002-08-22 18:25:32 +0000 | [diff] [blame] | 387 | return false; |
| 388 | } |
| 389 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 390 | // Provide a definition for the root virtual destructor. |
| 391 | AAResults::Concept::~Concept() {} |
| 392 | |
Chandler Carruth | 2be1075 | 2015-10-21 12:15:19 +0000 | [diff] [blame] | 393 | namespace { |
| 394 | /// A wrapper pass for external alias analyses. This just squirrels away the |
| 395 | /// callback used to run any analyses and register their results. |
| 396 | struct ExternalAAWrapperPass : ImmutablePass { |
| 397 | typedef std::function<void(Pass &, Function &, AAResults &)> CallbackT; |
| 398 | |
| 399 | CallbackT CB; |
| 400 | |
| 401 | static char ID; |
| 402 | |
| 403 | ExternalAAWrapperPass() : ImmutablePass(ID) { |
| 404 | initializeExternalAAWrapperPassPass(*PassRegistry::getPassRegistry()); |
| 405 | } |
| 406 | explicit ExternalAAWrapperPass(CallbackT CB) |
| 407 | : ImmutablePass(ID), CB(std::move(CB)) { |
| 408 | initializeExternalAAWrapperPassPass(*PassRegistry::getPassRegistry()); |
| 409 | } |
| 410 | |
| 411 | void getAnalysisUsage(AnalysisUsage &AU) const override { |
| 412 | AU.setPreservesAll(); |
| 413 | } |
| 414 | }; |
| 415 | } |
| 416 | |
| 417 | char ExternalAAWrapperPass::ID = 0; |
| 418 | INITIALIZE_PASS(ExternalAAWrapperPass, "external-aa", "External Alias Analysis", |
| 419 | false, true) |
| 420 | |
| 421 | ImmutablePass * |
| 422 | llvm::createExternalAAWrapperPass(ExternalAAWrapperPass::CallbackT Callback) { |
| 423 | return new ExternalAAWrapperPass(std::move(Callback)); |
| 424 | } |
| 425 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 426 | AAResultsWrapperPass::AAResultsWrapperPass() : FunctionPass(ID) { |
| 427 | initializeAAResultsWrapperPassPass(*PassRegistry::getPassRegistry()); |
| 428 | } |
| 429 | |
| 430 | char AAResultsWrapperPass::ID = 0; |
| 431 | |
| 432 | INITIALIZE_PASS_BEGIN(AAResultsWrapperPass, "aa", |
| 433 | "Function Alias Analysis Results", false, true) |
| 434 | INITIALIZE_PASS_DEPENDENCY(BasicAAWrapperPass) |
| 435 | INITIALIZE_PASS_DEPENDENCY(CFLAAWrapperPass) |
Chandler Carruth | 2be1075 | 2015-10-21 12:15:19 +0000 | [diff] [blame] | 436 | INITIALIZE_PASS_DEPENDENCY(ExternalAAWrapperPass) |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 437 | INITIALIZE_PASS_DEPENDENCY(GlobalsAAWrapperPass) |
| 438 | INITIALIZE_PASS_DEPENDENCY(ObjCARCAAWrapperPass) |
| 439 | INITIALIZE_PASS_DEPENDENCY(SCEVAAWrapperPass) |
| 440 | INITIALIZE_PASS_DEPENDENCY(ScopedNoAliasAAWrapperPass) |
| 441 | INITIALIZE_PASS_DEPENDENCY(TypeBasedAAWrapperPass) |
| 442 | INITIALIZE_PASS_END(AAResultsWrapperPass, "aa", |
| 443 | "Function Alias Analysis Results", false, true) |
| 444 | |
| 445 | FunctionPass *llvm::createAAResultsWrapperPass() { |
| 446 | return new AAResultsWrapperPass(); |
| 447 | } |
| 448 | |
| 449 | /// Run the wrapper pass to rebuild an aggregation over known AA passes. |
| 450 | /// |
| 451 | /// This is the legacy pass manager's interface to the new-style AA results |
| 452 | /// aggregation object. Because this is somewhat shoe-horned into the legacy |
| 453 | /// pass manager, we hard code all the specific alias analyses available into |
| 454 | /// it. While the particular set enabled is configured via commandline flags, |
| 455 | /// adding a new alias analysis to LLVM will require adding support for it to |
| 456 | /// this list. |
| 457 | bool AAResultsWrapperPass::runOnFunction(Function &F) { |
| 458 | // NB! This *must* be reset before adding new AA results to the new |
| 459 | // AAResults object because in the legacy pass manager, each instance |
| 460 | // of these will refer to the *same* immutable analyses, registering and |
| 461 | // unregistering themselves with them. We need to carefully tear down the |
| 462 | // previous object first, in this case replacing it with an empty one, before |
| 463 | // registering new results. |
| 464 | AAR.reset(new AAResults()); |
| 465 | |
| 466 | // BasicAA is always available for function analyses. Also, we add it first |
| 467 | // so that it can trump TBAA results when it proves MustAlias. |
| 468 | // FIXME: TBAA should have an explicit mode to support this and then we |
| 469 | // should reconsider the ordering here. |
| 470 | if (!DisableBasicAA) |
| 471 | AAR->addAAResult(getAnalysis<BasicAAWrapperPass>().getResult()); |
| 472 | |
| 473 | // Populate the results with the currently available AAs. |
| 474 | if (auto *WrapperPass = getAnalysisIfAvailable<ScopedNoAliasAAWrapperPass>()) |
| 475 | AAR->addAAResult(WrapperPass->getResult()); |
| 476 | if (auto *WrapperPass = getAnalysisIfAvailable<TypeBasedAAWrapperPass>()) |
| 477 | AAR->addAAResult(WrapperPass->getResult()); |
| 478 | if (auto *WrapperPass = |
| 479 | getAnalysisIfAvailable<objcarc::ObjCARCAAWrapperPass>()) |
| 480 | AAR->addAAResult(WrapperPass->getResult()); |
| 481 | if (auto *WrapperPass = getAnalysisIfAvailable<GlobalsAAWrapperPass>()) |
| 482 | AAR->addAAResult(WrapperPass->getResult()); |
| 483 | if (auto *WrapperPass = getAnalysisIfAvailable<SCEVAAWrapperPass>()) |
| 484 | AAR->addAAResult(WrapperPass->getResult()); |
| 485 | if (auto *WrapperPass = getAnalysisIfAvailable<CFLAAWrapperPass>()) |
| 486 | AAR->addAAResult(WrapperPass->getResult()); |
| 487 | |
Chandler Carruth | 2be1075 | 2015-10-21 12:15:19 +0000 | [diff] [blame] | 488 | // If available, run an external AA providing callback over the results as |
| 489 | // well. |
| 490 | if (auto *WrapperPass = getAnalysisIfAvailable<ExternalAAWrapperPass>()) |
| 491 | if (WrapperPass->CB) |
| 492 | WrapperPass->CB(*this, F, *AAR); |
| 493 | |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 494 | // Analyses don't mutate the IR, so return false. |
| 495 | return false; |
| 496 | } |
| 497 | |
| 498 | void AAResultsWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const { |
| 499 | AU.setPreservesAll(); |
| 500 | AU.addRequired<BasicAAWrapperPass>(); |
| 501 | |
| 502 | // We also need to mark all the alias analysis passes we will potentially |
| 503 | // probe in runOnFunction as used here to ensure the legacy pass manager |
| 504 | // preserves them. This hard coding of lists of alias analyses is specific to |
| 505 | // the legacy pass manager. |
| 506 | AU.addUsedIfAvailable<ScopedNoAliasAAWrapperPass>(); |
| 507 | AU.addUsedIfAvailable<TypeBasedAAWrapperPass>(); |
| 508 | AU.addUsedIfAvailable<objcarc::ObjCARCAAWrapperPass>(); |
| 509 | AU.addUsedIfAvailable<GlobalsAAWrapperPass>(); |
| 510 | AU.addUsedIfAvailable<SCEVAAWrapperPass>(); |
| 511 | AU.addUsedIfAvailable<CFLAAWrapperPass>(); |
| 512 | } |
| 513 | |
| 514 | AAResults llvm::createLegacyPMAAResults(Pass &P, Function &F, |
| 515 | BasicAAResult &BAR) { |
| 516 | AAResults AAR; |
| 517 | |
| 518 | // Add in our explicitly constructed BasicAA results. |
| 519 | if (!DisableBasicAA) |
| 520 | AAR.addAAResult(BAR); |
| 521 | |
| 522 | // Populate the results with the other currently available AAs. |
| 523 | if (auto *WrapperPass = |
| 524 | P.getAnalysisIfAvailable<ScopedNoAliasAAWrapperPass>()) |
| 525 | AAR.addAAResult(WrapperPass->getResult()); |
| 526 | if (auto *WrapperPass = P.getAnalysisIfAvailable<TypeBasedAAWrapperPass>()) |
| 527 | AAR.addAAResult(WrapperPass->getResult()); |
| 528 | if (auto *WrapperPass = |
| 529 | P.getAnalysisIfAvailable<objcarc::ObjCARCAAWrapperPass>()) |
| 530 | AAR.addAAResult(WrapperPass->getResult()); |
| 531 | if (auto *WrapperPass = P.getAnalysisIfAvailable<GlobalsAAWrapperPass>()) |
| 532 | AAR.addAAResult(WrapperPass->getResult()); |
Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 533 | if (auto *WrapperPass = P.getAnalysisIfAvailable<CFLAAWrapperPass>()) |
| 534 | AAR.addAAResult(WrapperPass->getResult()); |
| 535 | |
| 536 | return AAR; |
| 537 | } |
| 538 | |
Dan Gohman | fb306c0 | 2009-02-03 01:28:32 +0000 | [diff] [blame] | 539 | bool llvm::isNoAliasCall(const Value *V) { |
Benjamin Kramer | 45f3954 | 2015-08-05 14:16:44 +0000 | [diff] [blame] | 540 | if (auto CS = ImmutableCallSite(V)) |
| 541 | return CS.paramHasAttr(0, Attribute::NoAlias); |
Dan Gohman | fb306c0 | 2009-02-03 01:28:32 +0000 | [diff] [blame] | 542 | return false; |
| 543 | } |
| 544 | |
Sanjay Patel | d7f613d | 2016-01-13 22:17:13 +0000 | [diff] [blame] | 545 | bool llvm::isNoAliasArgument(const Value *V) { |
Michael Kuperstein | f3e663a | 2013-05-28 08:17:48 +0000 | [diff] [blame] | 546 | if (const Argument *A = dyn_cast<Argument>(V)) |
| 547 | return A->hasNoAliasAttr(); |
| 548 | return false; |
| 549 | } |
| 550 | |
Dan Gohman | 00ef932 | 2010-07-07 14:27:09 +0000 | [diff] [blame] | 551 | bool llvm::isIdentifiedObject(const Value *V) { |
Dan Gohman | 0824aff | 2010-06-29 00:50:39 +0000 | [diff] [blame] | 552 | if (isa<AllocaInst>(V)) |
Dan Gohman | 1f59f01 | 2009-08-27 17:52:56 +0000 | [diff] [blame] | 553 | return true; |
| 554 | if (isa<GlobalValue>(V) && !isa<GlobalAlias>(V)) |
Dan Gohman | fb306c0 | 2009-02-03 01:28:32 +0000 | [diff] [blame] | 555 | return true; |
Dan Gohman | 00ef932 | 2010-07-07 14:27:09 +0000 | [diff] [blame] | 556 | if (isNoAliasCall(V)) |
| 557 | return true; |
| 558 | if (const Argument *A = dyn_cast<Argument>(V)) |
| 559 | return A->hasNoAliasAttr() || A->hasByValAttr(); |
Dan Gohman | fb306c0 | 2009-02-03 01:28:32 +0000 | [diff] [blame] | 560 | return false; |
| 561 | } |
Hal Finkel | c782aa5 | 2014-07-21 12:27:23 +0000 | [diff] [blame] | 562 | |
Sanjay Patel | d7f613d | 2016-01-13 22:17:13 +0000 | [diff] [blame] | 563 | bool llvm::isIdentifiedFunctionLocal(const Value *V) { |
Hal Finkel | c782aa5 | 2014-07-21 12:27:23 +0000 | [diff] [blame] | 564 | return isa<AllocaInst>(V) || isNoAliasCall(V) || isNoAliasArgument(V); |
| 565 | } |
Sanjoy Das | 1c481f5 | 2016-02-09 01:21:57 +0000 | [diff] [blame^] | 566 | |
| 567 | void llvm::addUsedAAAnalyses(AnalysisUsage &AU) { |
| 568 | // This function needs to be in sync with llvm::createLegacyPMAAResults -- if |
| 569 | // more alias analyses are added to llvm::createLegacyPMAAResults, they need |
| 570 | // to be added here also. |
| 571 | AU.addUsedIfAvailable<ScopedNoAliasAAWrapperPass>(); |
| 572 | AU.addUsedIfAvailable<TypeBasedAAWrapperPass>(); |
| 573 | AU.addUsedIfAvailable<objcarc::ObjCARCAAWrapperPass>(); |
| 574 | AU.addUsedIfAvailable<GlobalsAAWrapperPass>(); |
| 575 | AU.addUsedIfAvailable<CFLAAWrapperPass>(); |
| 576 | } |