AliasAnalysis.h revision cd81d94322a39503e4a3e87b6ee03d4fcb3465fb
14df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner//===- llvm/Analysis/AliasAnalysis.h - Alias Analysis Interface -*- C++ -*-===//
29769ab22265b313171d201b5928688524a01bd87Misha Brukman//
36fbcc26f1460eaee4e0eb8b426fc1ff0c7af11beJohn Criswell//                     The LLVM Compiler Infrastructure
46fbcc26f1460eaee4e0eb8b426fc1ff0c7af11beJohn Criswell//
57ed47a13356daed2a34cd2209a31f92552e3bdd8Chris Lattner// This file is distributed under the University of Illinois Open Source
67ed47a13356daed2a34cd2209a31f92552e3bdd8Chris Lattner// License. See LICENSE.TXT for details.
79769ab22265b313171d201b5928688524a01bd87Misha Brukman//
86fbcc26f1460eaee4e0eb8b426fc1ff0c7af11beJohn Criswell//===----------------------------------------------------------------------===//
94df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner//
104df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner// This file defines the generic AliasAnalysis interface, which is used as the
114df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner// common interface used by all clients of alias analysis information, and
121c56b730a6313886076d7b293a126ae5576f5288Chris Lattner// implemented by all alias analysis implementations.  Mod/Ref information is
131c56b730a6313886076d7b293a126ae5576f5288Chris Lattner// also captured by this interface.
144df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner//
154df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner// Implementations of this interface must implement the various virtual methods,
164df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner// which automatically provides functionality for the entire suite of client
174df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner// APIs.
184df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner//
198e78cc4e130a8773cc8a2be2a94c4a97317ac383Dan Gohman// This API identifies memory regions with the Location class. The pointer
208e78cc4e130a8773cc8a2be2a94c4a97317ac383Dan Gohman// component specifies the base memory address of the region. The Size specifies
218e78cc4e130a8773cc8a2be2a94c4a97317ac383Dan Gohman// the maximum size (in address units) of the memory region, or UnknownSize if
228e78cc4e130a8773cc8a2be2a94c4a97317ac383Dan Gohman// the size is not known. The TBAA tag identifies the "type" of the memory
238e78cc4e130a8773cc8a2be2a94c4a97317ac383Dan Gohman// reference; see the TypeBasedAliasAnalysis class for details.
248e78cc4e130a8773cc8a2be2a94c4a97317ac383Dan Gohman//
258e78cc4e130a8773cc8a2be2a94c4a97317ac383Dan Gohman// Some non-obvious details include:
268e78cc4e130a8773cc8a2be2a94c4a97317ac383Dan Gohman//  - Pointers that point to two completely different objects in memory never
278e78cc4e130a8773cc8a2be2a94c4a97317ac383Dan Gohman//    alias, regardless of the value of the Size component.
288e78cc4e130a8773cc8a2be2a94c4a97317ac383Dan Gohman//  - NoAlias doesn't imply inequal pointers. The most obvious example of this
298e78cc4e130a8773cc8a2be2a94c4a97317ac383Dan Gohman//    is two pointers to constant memory. Even if they are equal, constant
308e78cc4e130a8773cc8a2be2a94c4a97317ac383Dan Gohman//    memory is never stored to, so there will never be any dependencies.
318e78cc4e130a8773cc8a2be2a94c4a97317ac383Dan Gohman//    In this and other situations, the pointers may be both NoAlias and
328e78cc4e130a8773cc8a2be2a94c4a97317ac383Dan Gohman//    MustAlias at the same time. The current API can only return one result,
338e78cc4e130a8773cc8a2be2a94c4a97317ac383Dan Gohman//    though this is rarely a problem in practice.
341c56b730a6313886076d7b293a126ae5576f5288Chris Lattner//
354df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner//===----------------------------------------------------------------------===//
364df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner
37674be02d525d4e24bc6943ed9274958c580bcfbcJakub Staszak#ifndef LLVM_ANALYSIS_ALIASANALYSIS_H
38674be02d525d4e24bc6943ed9274958c580bcfbcJakub Staszak#define LLVM_ANALYSIS_ALIASANALYSIS_H
394df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner
401fc18d71deb0e23a9101c87bb7b1455098ce1c09Dan Gohman#include "llvm/ADT/DenseMap.h"
4136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines#include "llvm/IR/CallSite.h"
42d0fde30ce850b78371fd1386338350591f9ff494Brian Gaeke
43d0fde30ce850b78371fd1386338350591f9ff494Brian Gaekenamespace llvm {
44d0fde30ce850b78371fd1386338350591f9ff494Brian Gaeke
451c56b730a6313886076d7b293a126ae5576f5288Chris Lattnerclass LoadInst;
461c56b730a6313886076d7b293a126ae5576f5288Chris Lattnerclass StoreInst;
4714f1703ae33e13dbcadd701603fd4d7a6f7010b9Andrew Lenharthclass VAArgInst;
483574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmowclass DataLayout;
498e0d1c03ca7fd86e6879b4e37d0d7f0e982feef6Benjamin Kramerclass TargetLibraryInfo;
506df60a9effe4d20a48cfd9d105c0ab3c5dc3e690Reid Spencerclass Pass;
516df60a9effe4d20a48cfd9d105c0ab3c5dc3e690Reid Spencerclass AnalysisUsage;
52e90c5cb747631b315350e7ee7424048c7778bdf9Chris Lattnerclass MemTransferInst;
539dc9e81aa7412b329bbaf51a589a81475214802bChris Lattnerclass MemIntrinsic;
543a884f5c17ac32e34e7e62b4602a0d73eeda1ce8Chad Rosierclass DominatorTree;
551c56b730a6313886076d7b293a126ae5576f5288Chris Lattner
561c56b730a6313886076d7b293a126ae5576f5288Chris Lattnerclass AliasAnalysis {
571c56b730a6313886076d7b293a126ae5576f5288Chris Lattnerprotected:
5836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  const DataLayout *DL;
598e0d1c03ca7fd86e6879b4e37d0d7f0e982feef6Benjamin Kramer  const TargetLibraryInfo *TLI;
60cb74993bdc37681ddbb80fa361575107afae1350Dan Gohman
61cb74993bdc37681ddbb80fa361575107afae1350Dan Gohmanprivate:
62ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner  AliasAnalysis *AA;       // Previous Alias Analysis to chain to.
63ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner
64cb74993bdc37681ddbb80fa361575107afae1350Dan Gohmanprotected:
651c56b730a6313886076d7b293a126ae5576f5288Chris Lattner  /// InitializeAliasAnalysis - Subclasses must call this method to initialize
661c56b730a6313886076d7b293a126ae5576f5288Chris Lattner  /// the AliasAnalysis interface before any other methods are called.  This is
671c56b730a6313886076d7b293a126ae5576f5288Chris Lattner  /// typically called by the run* methods of these subclasses.  This may be
681c56b730a6313886076d7b293a126ae5576f5288Chris Lattner  /// called multiple times.
691c56b730a6313886076d7b293a126ae5576f5288Chris Lattner  ///
701c56b730a6313886076d7b293a126ae5576f5288Chris Lattner  void InitializeAliasAnalysis(Pass *P);
719769ab22265b313171d201b5928688524a01bd87Misha Brukman
7264d237cfae6bcb11157d525c79b5a5335e30370bDan Gohman  /// getAnalysisUsage - All alias analysis implementations should invoke this
73fc2a3ed0c9e32cf7edaf5030fa0972b916cc5f0bDan Gohman  /// directly (using AliasAnalysis::getAnalysisUsage(AU)).
741c56b730a6313886076d7b293a126ae5576f5288Chris Lattner  virtual void getAnalysisUsage(AnalysisUsage &AU) const;
751c56b730a6313886076d7b293a126ae5576f5288Chris Lattner
761c56b730a6313886076d7b293a126ae5576f5288Chris Lattnerpublic:
771997473cf72957d0e70322e2fe6fe2ab141c58a6Devang Patel  static char ID; // Class identification, replacement for typeinfo
78dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines  AliasAnalysis() : DL(nullptr), TLI(nullptr), AA(nullptr) {}
791c56b730a6313886076d7b293a126ae5576f5288Chris Lattner  virtual ~AliasAnalysis();  // We want to be subclassed
801c56b730a6313886076d7b293a126ae5576f5288Chris Lattner
81ef1cfac9e50def9097cd3e3ab3c5cad7f4c758ccDan Gohman  /// UnknownSize - This is a special value which can be used with the
82ef1cfac9e50def9097cd3e3ab3c5cad7f4c758ccDan Gohman  /// size arguments in alias queries to indicate that the caller does not
83ef1cfac9e50def9097cd3e3ab3c5cad7f4c758ccDan Gohman  /// know the sizes of the potential memory references.
843da848bbda62b25c12335998aaa44ab361f0bf15Dan Gohman  static uint64_t const UnknownSize = ~UINT64_C(0);
85ef1cfac9e50def9097cd3e3ab3c5cad7f4c758ccDan Gohman
863574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmow  /// getDataLayout - Return a pointer to the current DataLayout object, or
873574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmow  /// null if no DataLayout object is available.
88dd298c8c6eb036baf35bf5a559c59d2afd2c7944Misha Brukman  ///
8936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines  const DataLayout *getDataLayout() const { return DL; }
90fc2a3ed0c9e32cf7edaf5030fa0972b916cc5f0bDan Gohman
918e0d1c03ca7fd86e6879b4e37d0d7f0e982feef6Benjamin Kramer  /// getTargetLibraryInfo - Return a pointer to the current TargetLibraryInfo
928e0d1c03ca7fd86e6879b4e37d0d7f0e982feef6Benjamin Kramer  /// object, or null if no TargetLibraryInfo object is available.
938e0d1c03ca7fd86e6879b4e37d0d7f0e982feef6Benjamin Kramer  ///
948e0d1c03ca7fd86e6879b4e37d0d7f0e982feef6Benjamin Kramer  const TargetLibraryInfo *getTargetLibraryInfo() const { return TLI; }
958e0d1c03ca7fd86e6879b4e37d0d7f0e982feef6Benjamin Kramer
963574eca1b02600bac4e625297f4ecf745f4c4f32Micah Villmow  /// getTypeStoreSize - Return the DataLayout store size for the given type,
97fc2a3ed0c9e32cf7edaf5030fa0972b916cc5f0bDan Gohman  /// if known, or a conservative value otherwise.
98fc2a3ed0c9e32cf7edaf5030fa0972b916cc5f0bDan Gohman  ///
99db125cfaf57cc83e7dd7453de2d509bc8efd0e5eChris Lattner  uint64_t getTypeStoreSize(Type *Ty);
1004df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner
1011c56b730a6313886076d7b293a126ae5576f5288Chris Lattner  //===--------------------------------------------------------------------===//
1021c56b730a6313886076d7b293a126ae5576f5288Chris Lattner  /// Alias Queries...
1031c56b730a6313886076d7b293a126ae5576f5288Chris Lattner  ///
1044df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner
105b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  /// Location - A description of a memory location.
106b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  struct Location {
107b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman    /// Ptr - The address of the start of the location.
108b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman    const Value *Ptr;
109a6d60ddbbb0c33690f7e89cad2b5e60cee84b89eDan Gohman    /// Size - The maximum size of the location, in address-units, or
110a6d60ddbbb0c33690f7e89cad2b5e60cee84b89eDan Gohman    /// UnknownSize if the size is not known.  Note that an unknown size does
111a6d60ddbbb0c33690f7e89cad2b5e60cee84b89eDan Gohman    /// not mean the pointer aliases the entire virtual address space, because
112a6d60ddbbb0c33690f7e89cad2b5e60cee84b89eDan Gohman    /// there are restrictions on stepping out of one object and into another.
1136c25c920e66aa2d8f6b48454bc9770087ff7939aDan Gohman    /// See http://llvm.org/docs/LangRef.html#pointeraliasing
1143da848bbda62b25c12335998aaa44ab361f0bf15Dan Gohman    uint64_t Size;
115b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman    /// TBAATag - The metadata node which describes the TBAA type of
1166c25c920e66aa2d8f6b48454bc9770087ff7939aDan Gohman    /// the location, or null if there is no known unique tag.
117b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman    const MDNode *TBAATag;
118b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman
119dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines    explicit Location(const Value *P = nullptr, uint64_t S = UnknownSize,
120dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines                      const MDNode *N = nullptr)
121b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman      : Ptr(P), Size(S), TBAATag(N) {}
1229f27074f42f03af640977006dc7c05005fb77991Dan Gohman
1239f27074f42f03af640977006dc7c05005fb77991Dan Gohman    Location getWithNewPtr(const Value *NewPtr) const {
1249f27074f42f03af640977006dc7c05005fb77991Dan Gohman      Location Copy(*this);
1259f27074f42f03af640977006dc7c05005fb77991Dan Gohman      Copy.Ptr = NewPtr;
1269f27074f42f03af640977006dc7c05005fb77991Dan Gohman      return Copy;
1279f27074f42f03af640977006dc7c05005fb77991Dan Gohman    }
1289f27074f42f03af640977006dc7c05005fb77991Dan Gohman
129075fb5d68fcb55d26e44c48f07dfdbbfa21ccb2aDan Gohman    Location getWithNewSize(uint64_t NewSize) const {
130075fb5d68fcb55d26e44c48f07dfdbbfa21ccb2aDan Gohman      Location Copy(*this);
131075fb5d68fcb55d26e44c48f07dfdbbfa21ccb2aDan Gohman      Copy.Size = NewSize;
132075fb5d68fcb55d26e44c48f07dfdbbfa21ccb2aDan Gohman      return Copy;
133075fb5d68fcb55d26e44c48f07dfdbbfa21ccb2aDan Gohman    }
134075fb5d68fcb55d26e44c48f07dfdbbfa21ccb2aDan Gohman
1359f27074f42f03af640977006dc7c05005fb77991Dan Gohman    Location getWithoutTBAATag() const {
1369f27074f42f03af640977006dc7c05005fb77991Dan Gohman      Location Copy(*this);
137dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines      Copy.TBAATag = nullptr;
1389f27074f42f03af640977006dc7c05005fb77991Dan Gohman      return Copy;
1399f27074f42f03af640977006dc7c05005fb77991Dan Gohman    }
140b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  };
141b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman
1426d8eb156e6be727570b300bac7712f745a318c7dDan Gohman  /// getLocation - Fill in Loc with information about the memory reference by
1436d8eb156e6be727570b300bac7712f745a318c7dDan Gohman  /// the given instruction.
1446d8eb156e6be727570b300bac7712f745a318c7dDan Gohman  Location getLocation(const LoadInst *LI);
1456d8eb156e6be727570b300bac7712f745a318c7dDan Gohman  Location getLocation(const StoreInst *SI);
1466d8eb156e6be727570b300bac7712f745a318c7dDan Gohman  Location getLocation(const VAArgInst *VI);
14746cb5afdcd031c371c78201fb34291d9d48b2ee4Eli Friedman  Location getLocation(const AtomicCmpXchgInst *CXI);
14846cb5afdcd031c371c78201fb34291d9d48b2ee4Eli Friedman  Location getLocation(const AtomicRMWInst *RMWI);
14916f7993e0df4bd0727f8535bd47a2776bec10545Chris Lattner  static Location getLocationForSource(const MemTransferInst *MTI);
1509dc9e81aa7412b329bbaf51a589a81475214802bChris Lattner  static Location getLocationForDest(const MemIntrinsic *MI);
1516d8eb156e6be727570b300bac7712f745a318c7dDan Gohman
152f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner  /// Alias analysis result - Either we know for sure that it does not alias, we
153f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner  /// know for sure it must alias, or we don't know anything: The two pointers
154f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner  /// _might_ alias.  This enum is designed so you can do things like:
155f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner  ///     if (AA.alias(P1, P2)) { ... }
156f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner  /// to check to see if two pointers might alias.
157f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner  ///
158e53e3772f3c8b4cba69b7d77c8b2148a080fe9aeDan Gohman  /// See docs/AliasAnalysis.html for more information on the specific meanings
159e53e3772f3c8b4cba69b7d77c8b2148a080fe9aeDan Gohman  /// of these values.
160e53e3772f3c8b4cba69b7d77c8b2148a080fe9aeDan Gohman  ///
16117e8078ae14ed71f657d59c77efa3bedf171161aDan Gohman  enum AliasResult {
16217e8078ae14ed71f657d59c77efa3bedf171161aDan Gohman    NoAlias = 0,        ///< No dependencies.
1634a34cbd2b9ba9efcdab4c4e656df2d7bd22e2604Dan Gohman    MayAlias,           ///< Anything goes.
1644a34cbd2b9ba9efcdab4c4e656df2d7bd22e2604Dan Gohman    PartialAlias,       ///< Pointers differ, but pointees overlap.
1654a34cbd2b9ba9efcdab4c4e656df2d7bd22e2604Dan Gohman    MustAlias           ///< Pointers are equal.
16617e8078ae14ed71f657d59c77efa3bedf171161aDan Gohman  };
1674df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner
168f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner  /// alias - The main low level interface to the alias analysis implementation.
1696c25c920e66aa2d8f6b48454bc9770087ff7939aDan Gohman  /// Returns an AliasResult indicating whether the two pointers are aliased to
1706c25c920e66aa2d8f6b48454bc9770087ff7939aDan Gohman  /// each other.  This is the interface that must be implemented by specific
1716c25c920e66aa2d8f6b48454bc9770087ff7939aDan Gohman  /// alias analysis implementations.
172b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  virtual AliasResult alias(const Location &LocA, const Location &LocB);
1734df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner
174b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  /// alias - A convenience wrapper.
1753da848bbda62b25c12335998aaa44ab361f0bf15Dan Gohman  AliasResult alias(const Value *V1, uint64_t V1Size,
1763da848bbda62b25c12335998aaa44ab361f0bf15Dan Gohman                    const Value *V2, uint64_t V2Size) {
177b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman    return alias(Location(V1, V1Size), Location(V2, V2Size));
178b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  }
179b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman
180b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  /// alias - A convenience wrapper.
181847a84efd23a2c7d90429b82f6e0f19d1f913d9aDan Gohman  AliasResult alias(const Value *V1, const Value *V2) {
182ef1cfac9e50def9097cd3e3ab3c5cad7f4c758ccDan Gohman    return alias(V1, UnknownSize, V2, UnknownSize);
183847a84efd23a2c7d90429b82f6e0f19d1f913d9aDan Gohman  }
184847a84efd23a2c7d90429b82f6e0f19d1f913d9aDan Gohman
185c46530b6a32a53edf0d6d32bcd09ea5d76940472Chris Lattner  /// isNoAlias - A trivial helper function to check to see if the specified
186c46530b6a32a53edf0d6d32bcd09ea5d76940472Chris Lattner  /// pointers are no-alias.
187b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  bool isNoAlias(const Location &LocA, const Location &LocB) {
188b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman    return alias(LocA, LocB) == NoAlias;
189b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  }
190b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman
191b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  /// isNoAlias - A convenience wrapper.
1923da848bbda62b25c12335998aaa44ab361f0bf15Dan Gohman  bool isNoAlias(const Value *V1, uint64_t V1Size,
1933da848bbda62b25c12335998aaa44ab361f0bf15Dan Gohman                 const Value *V2, uint64_t V2Size) {
194b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman    return isNoAlias(Location(V1, V1Size), Location(V2, V2Size));
195c46530b6a32a53edf0d6d32bcd09ea5d76940472Chris Lattner  }
19672c194a8be83d217360ebc6b1f3ad21c5ffa16a9Chris Lattner
197230768bd1316a012e88ac62689589fe5e2f10456Dan Gohman  /// isNoAlias - A convenience wrapper.
198230768bd1316a012e88ac62689589fe5e2f10456Dan Gohman  bool isNoAlias(const Value *V1, const Value *V2) {
199230768bd1316a012e88ac62689589fe5e2f10456Dan Gohman    return isNoAlias(Location(V1), Location(V2));
200230768bd1316a012e88ac62689589fe5e2f10456Dan Gohman  }
201230768bd1316a012e88ac62689589fe5e2f10456Dan Gohman
20272c194a8be83d217360ebc6b1f3ad21c5ffa16a9Chris Lattner  /// isMustAlias - A convenience wrapper.
20372c194a8be83d217360ebc6b1f3ad21c5ffa16a9Chris Lattner  bool isMustAlias(const Location &LocA, const Location &LocB) {
20472c194a8be83d217360ebc6b1f3ad21c5ffa16a9Chris Lattner    return alias(LocA, LocB) == MustAlias;
20572c194a8be83d217360ebc6b1f3ad21c5ffa16a9Chris Lattner  }
206c46530b6a32a53edf0d6d32bcd09ea5d76940472Chris Lattner
207cc10244d7725f191bdc91cd62befff0c97257c7bChris Lattner  /// isMustAlias - A convenience wrapper.
208cc10244d7725f191bdc91cd62befff0c97257c7bChris Lattner  bool isMustAlias(const Value *V1, const Value *V2) {
209cc10244d7725f191bdc91cd62befff0c97257c7bChris Lattner    return alias(V1, 1, V2, 1) == MustAlias;
210cc10244d7725f191bdc91cd62befff0c97257c7bChris Lattner  }
211cc10244d7725f191bdc91cd62befff0c97257c7bChris Lattner
212a25e5dbcc2371352386a01e3c1b8e76dd890272bDan Gohman  /// pointsToConstantMemory - If the specified memory location is
213a25e5dbcc2371352386a01e3c1b8e76dd890272bDan Gohman  /// known to be constant, return true. If OrLocal is true and the
214a25e5dbcc2371352386a01e3c1b8e76dd890272bDan Gohman  /// specified memory location is known to be "local" (derived from
215a25e5dbcc2371352386a01e3c1b8e76dd890272bDan Gohman  /// an alloca), return true. Otherwise return false.
216a25e5dbcc2371352386a01e3c1b8e76dd890272bDan Gohman  virtual bool pointsToConstantMemory(const Location &Loc,
217a25e5dbcc2371352386a01e3c1b8e76dd890272bDan Gohman                                      bool OrLocal = false);
218b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman
219b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  /// pointsToConstantMemory - A convenient wrapper.
220a25e5dbcc2371352386a01e3c1b8e76dd890272bDan Gohman  bool pointsToConstantMemory(const Value *P, bool OrLocal = false) {
221a25e5dbcc2371352386a01e3c1b8e76dd890272bDan Gohman    return pointsToConstantMemory(Location(P), OrLocal);
222b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  }
22362b5c167de0ca5883a7ad5eb0900eb0c15ad3707Chris Lattner
224248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner  //===--------------------------------------------------------------------===//
225248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner  /// Simple mod/ref information...
226248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner  ///
227248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner
228248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner  /// ModRefResult - Represent the result of a mod/ref query.  Mod and Ref are
229248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner  /// bits which may be or'd together.
230248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner  ///
231248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner  enum ModRefResult { NoModRef = 0, Ref = 1, Mod = 2, ModRef = 3 };
2329769ab22265b313171d201b5928688524a01bd87Misha Brukman
23342c31a70735e55bf82e66a9315c97d1821c9a798Dan Gohman  /// These values define additional bits used to define the
23442c31a70735e55bf82e66a9315c97d1821c9a798Dan Gohman  /// ModRefBehavior values.
23542c31a70735e55bf82e66a9315c97d1821c9a798Dan Gohman  enum { Nowhere = 0, ArgumentPointees = 4, Anywhere = 8 | ArgumentPointees };
2369769ab22265b313171d201b5928688524a01bd87Misha Brukman
237248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner  /// ModRefBehavior - Summary of how a function affects memory in the program.
238248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner  /// Loads from constant globals are not considered memory accesses for this
239248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner  /// interface.  Also, functions may freely modify stack space local to their
240248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner  /// invocation without having to report it through these interfaces.
241248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner  enum ModRefBehavior {
24250a04d067f8803d52cababdabe5c188844c5c210Dan Gohman    /// DoesNotAccessMemory - This function does not perform any non-local loads
24350a04d067f8803d52cababdabe5c188844c5c210Dan Gohman    /// or stores to memory.
24450a04d067f8803d52cababdabe5c188844c5c210Dan Gohman    ///
24550a04d067f8803d52cababdabe5c188844c5c210Dan Gohman    /// This property corresponds to the GCC 'const' attribute.
24650a04d067f8803d52cababdabe5c188844c5c210Dan Gohman    /// This property corresponds to the LLVM IR 'readnone' attribute.
24750a04d067f8803d52cababdabe5c188844c5c210Dan Gohman    /// This property corresponds to the IntrNoMem LLVM intrinsic flag.
24842c31a70735e55bf82e66a9315c97d1821c9a798Dan Gohman    DoesNotAccessMemory = Nowhere | NoModRef,
2499769ab22265b313171d201b5928688524a01bd87Misha Brukman
250e88ccb545d0e03fd4445d361100fc95f350c6663Dan Gohman    /// OnlyReadsArgumentPointees - The only memory references in this function
251e88ccb545d0e03fd4445d361100fc95f350c6663Dan Gohman    /// (if it has any) are non-volatile loads from objects pointed to by its
252e88ccb545d0e03fd4445d361100fc95f350c6663Dan Gohman    /// pointer-typed arguments, with arbitrary offsets.
25350a04d067f8803d52cababdabe5c188844c5c210Dan Gohman    ///
25450a04d067f8803d52cababdabe5c188844c5c210Dan Gohman    /// This property corresponds to the IntrReadArgMem LLVM intrinsic flag.
255e88ccb545d0e03fd4445d361100fc95f350c6663Dan Gohman    OnlyReadsArgumentPointees = ArgumentPointees | Ref,
256db78c4873ea8c4b3dce90d761a1ad59d5bcdd6e7Dan Gohman
257e88ccb545d0e03fd4445d361100fc95f350c6663Dan Gohman    /// OnlyAccessesArgumentPointees - The only memory references in this
258e88ccb545d0e03fd4445d361100fc95f350c6663Dan Gohman    /// function (if it has any) are non-volatile loads and stores from objects
259e88ccb545d0e03fd4445d361100fc95f350c6663Dan Gohman    /// pointed to by its pointer-typed arguments, with arbitrary offsets.
26050a04d067f8803d52cababdabe5c188844c5c210Dan Gohman    ///
26150a04d067f8803d52cababdabe5c188844c5c210Dan Gohman    /// This property corresponds to the IntrReadWriteArgMem LLVM intrinsic flag.
262e88ccb545d0e03fd4445d361100fc95f350c6663Dan Gohman    OnlyAccessesArgumentPointees = ArgumentPointees | ModRef,
2639769ab22265b313171d201b5928688524a01bd87Misha Brukman
26450a04d067f8803d52cababdabe5c188844c5c210Dan Gohman    /// OnlyReadsMemory - This function does not perform any non-local stores or
26550a04d067f8803d52cababdabe5c188844c5c210Dan Gohman    /// volatile loads, but may read from any memory location.
26650a04d067f8803d52cababdabe5c188844c5c210Dan Gohman    ///
26750a04d067f8803d52cababdabe5c188844c5c210Dan Gohman    /// This property corresponds to the GCC 'pure' attribute.
26850a04d067f8803d52cababdabe5c188844c5c210Dan Gohman    /// This property corresponds to the LLVM IR 'readonly' attribute.
26950a04d067f8803d52cababdabe5c188844c5c210Dan Gohman    /// This property corresponds to the IntrReadMem LLVM intrinsic flag.
27042c31a70735e55bf82e66a9315c97d1821c9a798Dan Gohman    OnlyReadsMemory = Anywhere | Ref,
2719769ab22265b313171d201b5928688524a01bd87Misha Brukman
27250a04d067f8803d52cababdabe5c188844c5c210Dan Gohman    /// UnknownModRefBehavior - This indicates that the function could not be
27350a04d067f8803d52cababdabe5c188844c5c210Dan Gohman    /// classified into one of the behaviors above.
27442c31a70735e55bf82e66a9315c97d1821c9a798Dan Gohman    UnknownModRefBehavior = Anywhere | ModRef
275248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner  };
2769769ab22265b313171d201b5928688524a01bd87Misha Brukman
277cd81d94322a39503e4a3e87b6ee03d4fcb3465fbStephen Hines  /// Get the location associated with a pointer argument of a callsite.
278cd81d94322a39503e4a3e87b6ee03d4fcb3465fbStephen Hines  /// The mask bits are set to indicate the allowed aliasing ModRef kinds.
279cd81d94322a39503e4a3e87b6ee03d4fcb3465fbStephen Hines  /// Note that these mask bits do not necessarily account for the overall
280cd81d94322a39503e4a3e87b6ee03d4fcb3465fbStephen Hines  /// behavior of the function, but rather only provide additional
281cd81d94322a39503e4a3e87b6ee03d4fcb3465fbStephen Hines  /// per-argument information.
282cd81d94322a39503e4a3e87b6ee03d4fcb3465fbStephen Hines  virtual Location getArgLocation(ImmutableCallSite CS, unsigned ArgIdx,
283cd81d94322a39503e4a3e87b6ee03d4fcb3465fbStephen Hines                                  ModRefResult &Mask);
284cd81d94322a39503e4a3e87b6ee03d4fcb3465fbStephen Hines
285dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands  /// getModRefBehavior - Return the behavior when calling the given call site.
286a41af344c2964573318a77e2b43eafd4d3804003Dan Gohman  virtual ModRefBehavior getModRefBehavior(ImmutableCallSite CS);
287dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands
288dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands  /// getModRefBehavior - Return the behavior when calling the given function.
289dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands  /// For use when the call site is not known.
290a41af344c2964573318a77e2b43eafd4d3804003Dan Gohman  virtual ModRefBehavior getModRefBehavior(const Function *F);
291dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands
292dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands  /// doesNotAccessMemory - If the specified call is known to never read or
293dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands  /// write memory, return true.  If the call only reads from known-constant
294dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands  /// memory, it is also legal to return true.  Calls that unwind the stack
295dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands  /// are legal for this predicate.
2963e295b1b59e47916c8ae5d42eb27a23bd580cabeChris Lattner  ///
297dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands  /// Many optimizations (such as CSE and LICM) can be performed on such calls
298dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands  /// without worrying about aliasing properties, and many calls have this
299dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands  /// property (e.g. calls to 'sin' and 'cos').
3003e295b1b59e47916c8ae5d42eb27a23bd580cabeChris Lattner  ///
3013e295b1b59e47916c8ae5d42eb27a23bd580cabeChris Lattner  /// This property corresponds to the GCC 'const' attribute.
3023e295b1b59e47916c8ae5d42eb27a23bd580cabeChris Lattner  ///
30379fca6fea87be7221843031870bbf2c9ae1fc555Dan Gohman  bool doesNotAccessMemory(ImmutableCallSite CS) {
304652f7ea955bb433d6b7a4d33685dca9485fd7b8bEvan Cheng    return getModRefBehavior(CS) == DoesNotAccessMemory;
305dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands  }
306dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands
307dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands  /// doesNotAccessMemory - If the specified function is known to never read or
308dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands  /// write memory, return true.  For use when the call site is not known.
309dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands  ///
31079fca6fea87be7221843031870bbf2c9ae1fc555Dan Gohman  bool doesNotAccessMemory(const Function *F) {
311dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands    return getModRefBehavior(F) == DoesNotAccessMemory;
312248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner  }
3133e295b1b59e47916c8ae5d42eb27a23bd580cabeChris Lattner
314dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands  /// onlyReadsMemory - If the specified call is known to only read from
315dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands  /// non-volatile memory (or not access memory at all), return true.  Calls
316dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands  /// that unwind the stack are legal for this predicate.
3173e295b1b59e47916c8ae5d42eb27a23bd580cabeChris Lattner  ///
3183e295b1b59e47916c8ae5d42eb27a23bd580cabeChris Lattner  /// This property allows many common optimizations to be performed in the
3193e295b1b59e47916c8ae5d42eb27a23bd580cabeChris Lattner  /// absence of interfering store instructions, such as CSE of strlen calls.
3203e295b1b59e47916c8ae5d42eb27a23bd580cabeChris Lattner  ///
3213e295b1b59e47916c8ae5d42eb27a23bd580cabeChris Lattner  /// This property corresponds to the GCC 'pure' attribute.
3223e295b1b59e47916c8ae5d42eb27a23bd580cabeChris Lattner  ///
32379fca6fea87be7221843031870bbf2c9ae1fc555Dan Gohman  bool onlyReadsMemory(ImmutableCallSite CS) {
324467a0adfc8b6bd4b114e024c200c159497a4cd86Dan Gohman    return onlyReadsMemory(getModRefBehavior(CS));
325dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands  }
326dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands
327dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands  /// onlyReadsMemory - If the specified function is known to only read from
328dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands  /// non-volatile memory (or not access memory at all), return true.  For use
329dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands  /// when the call site is not known.
330dff6710717b159f089c76a07eda074eb6347eb92Duncan Sands  ///
33179fca6fea87be7221843031870bbf2c9ae1fc555Dan Gohman  bool onlyReadsMemory(const Function *F) {
332467a0adfc8b6bd4b114e024c200c159497a4cd86Dan Gohman    return onlyReadsMemory(getModRefBehavior(F));
333467a0adfc8b6bd4b114e024c200c159497a4cd86Dan Gohman  }
334467a0adfc8b6bd4b114e024c200c159497a4cd86Dan Gohman
335432d08cbdb9ceaa333f1d6eab4f8b542fdddf9dbDan Gohman  /// onlyReadsMemory - Return true if functions with the specified behavior are
336432d08cbdb9ceaa333f1d6eab4f8b542fdddf9dbDan Gohman  /// known to only read from non-volatile memory (or not access memory at all).
337467a0adfc8b6bd4b114e024c200c159497a4cd86Dan Gohman  ///
338467a0adfc8b6bd4b114e024c200c159497a4cd86Dan Gohman  static bool onlyReadsMemory(ModRefBehavior MRB) {
33942c31a70735e55bf82e66a9315c97d1821c9a798Dan Gohman    return !(MRB & Mod);
340248e8ebeff834db9b78917b1531eeee7035eb113Chris Lattner  }
3414df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner
342432d08cbdb9ceaa333f1d6eab4f8b542fdddf9dbDan Gohman  /// onlyAccessesArgPointees - Return true if functions with the specified
343b395e4a0262c36b17b18aa33514b2daf2a85e9a3Dan Gohman  /// behavior are known to read and write at most from objects pointed to by
344b395e4a0262c36b17b18aa33514b2daf2a85e9a3Dan Gohman  /// their pointer-typed arguments (with arbitrary offsets).
345432d08cbdb9ceaa333f1d6eab4f8b542fdddf9dbDan Gohman  ///
346432d08cbdb9ceaa333f1d6eab4f8b542fdddf9dbDan Gohman  static bool onlyAccessesArgPointees(ModRefBehavior MRB) {
347432d08cbdb9ceaa333f1d6eab4f8b542fdddf9dbDan Gohman    return !(MRB & Anywhere & ~ArgumentPointees);
348432d08cbdb9ceaa333f1d6eab4f8b542fdddf9dbDan Gohman  }
349432d08cbdb9ceaa333f1d6eab4f8b542fdddf9dbDan Gohman
35068a6056dafd4913ce42606353ab1ff7208215ff2Dan Gohman  /// doesAccessArgPointees - Return true if functions with the specified
35156169787dbfb6d0b422ef114889b481e977b8996Nick Lewycky  /// behavior are known to potentially read or write from objects pointed
35268a6056dafd4913ce42606353ab1ff7208215ff2Dan Gohman  /// to be their pointer-typed arguments (with arbitrary offsets).
35368a6056dafd4913ce42606353ab1ff7208215ff2Dan Gohman  ///
35468a6056dafd4913ce42606353ab1ff7208215ff2Dan Gohman  static bool doesAccessArgPointees(ModRefBehavior MRB) {
35568a6056dafd4913ce42606353ab1ff7208215ff2Dan Gohman    return (MRB & ModRef) && (MRB & ArgumentPointees);
35668a6056dafd4913ce42606353ab1ff7208215ff2Dan Gohman  }
35768a6056dafd4913ce42606353ab1ff7208215ff2Dan Gohman
3581c56b730a6313886076d7b293a126ae5576f5288Chris Lattner  /// getModRefInfo - Return information about whether or not an instruction may
359b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  /// read or write the specified memory location.  An instruction
3601c56b730a6313886076d7b293a126ae5576f5288Chris Lattner  /// that doesn't read or write memory may be trivially LICM'd for example.
361fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman  ModRefResult getModRefInfo(const Instruction *I,
362b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman                             const Location &Loc) {
363fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman    switch (I->getOpcode()) {
364b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman    case Instruction::VAArg:  return getModRefInfo((const VAArgInst*)I, Loc);
365b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman    case Instruction::Load:   return getModRefInfo((const LoadInst*)I,  Loc);
366b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman    case Instruction::Store:  return getModRefInfo((const StoreInst*)I, Loc);
3678a552bb85a5e9a6c250c0a899941fbd3ae7b5006Eli Friedman    case Instruction::Fence:  return getModRefInfo((const FenceInst*)I, Loc);
36855ba816883842e793cdeb32fcb805c4e011b527fEli Friedman    case Instruction::AtomicCmpXchg:
36955ba816883842e793cdeb32fcb805c4e011b527fEli Friedman      return getModRefInfo((const AtomicCmpXchgInst*)I, Loc);
37055ba816883842e793cdeb32fcb805c4e011b527fEli Friedman    case Instruction::AtomicRMW:
37155ba816883842e793cdeb32fcb805c4e011b527fEli Friedman      return getModRefInfo((const AtomicRMWInst*)I, Loc);
372b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman    case Instruction::Call:   return getModRefInfo((const CallInst*)I,  Loc);
373b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman    case Instruction::Invoke: return getModRefInfo((const InvokeInst*)I,Loc);
374fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman    default:                  return NoModRef;
375fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman    }
376fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman  }
3771c56b730a6313886076d7b293a126ae5576f5288Chris Lattner
378b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  /// getModRefInfo - A convenience wrapper.
379b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  ModRefResult getModRefInfo(const Instruction *I,
3803da848bbda62b25c12335998aaa44ab361f0bf15Dan Gohman                             const Value *P, uint64_t Size) {
381b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman    return getModRefInfo(I, Location(P, Size));
382b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  }
383b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman
3842bf786af90b8c3826974b2a9deea5e8081ebf113Sean Silva  /// getModRefInfo (for call sites) - Return information about whether
385b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  /// a particular call site modifies or reads the specified memory location.
38679fca6fea87be7221843031870bbf2c9ae1fc555Dan Gohman  virtual ModRefResult getModRefInfo(ImmutableCallSite CS,
387b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman                                     const Location &Loc);
388b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman
389b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  /// getModRefInfo (for call sites) - A convenience wrapper.
390b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  ModRefResult getModRefInfo(ImmutableCallSite CS,
3913da848bbda62b25c12335998aaa44ab361f0bf15Dan Gohman                             const Value *P, uint64_t Size) {
392b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman    return getModRefInfo(CS, Location(P, Size));
393b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  }
3941c56b730a6313886076d7b293a126ae5576f5288Chris Lattner
3952bf786af90b8c3826974b2a9deea5e8081ebf113Sean Silva  /// getModRefInfo (for calls) - Return information about whether
396b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  /// a particular call modifies or reads the specified memory location.
397b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  ModRefResult getModRefInfo(const CallInst *C, const Location &Loc) {
398b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman    return getModRefInfo(ImmutableCallSite(C), Loc);
399b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  }
400b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman
401b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  /// getModRefInfo (for calls) - A convenience wrapper.
4023da848bbda62b25c12335998aaa44ab361f0bf15Dan Gohman  ModRefResult getModRefInfo(const CallInst *C, const Value *P, uint64_t Size) {
403b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman    return getModRefInfo(C, Location(P, Size));
4041c56b730a6313886076d7b293a126ae5576f5288Chris Lattner  }
405fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman
4062bf786af90b8c3826974b2a9deea5e8081ebf113Sean Silva  /// getModRefInfo (for invokes) - Return information about whether
407b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  /// a particular invoke modifies or reads the specified memory location.
408b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  ModRefResult getModRefInfo(const InvokeInst *I,
409b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman                             const Location &Loc) {
410b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman    return getModRefInfo(ImmutableCallSite(I), Loc);
411b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  }
412b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman
413b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  /// getModRefInfo (for invokes) - A convenience wrapper.
41479fca6fea87be7221843031870bbf2c9ae1fc555Dan Gohman  ModRefResult getModRefInfo(const InvokeInst *I,
4153da848bbda62b25c12335998aaa44ab361f0bf15Dan Gohman                             const Value *P, uint64_t Size) {
416b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman    return getModRefInfo(I, Location(P, Size));
4171c56b730a6313886076d7b293a126ae5576f5288Chris Lattner  }
418fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman
4192bf786af90b8c3826974b2a9deea5e8081ebf113Sean Silva  /// getModRefInfo (for loads) - Return information about whether
420b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  /// a particular load modifies or reads the specified memory location.
421b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  ModRefResult getModRefInfo(const LoadInst *L, const Location &Loc);
422b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman
423b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  /// getModRefInfo (for loads) - A convenience wrapper.
4243da848bbda62b25c12335998aaa44ab361f0bf15Dan Gohman  ModRefResult getModRefInfo(const LoadInst *L, const Value *P, uint64_t Size) {
425b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman    return getModRefInfo(L, Location(P, Size));
426b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  }
427fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman
4282bf786af90b8c3826974b2a9deea5e8081ebf113Sean Silva  /// getModRefInfo (for stores) - Return information about whether
429b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  /// a particular store modifies or reads the specified memory location.
430b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  ModRefResult getModRefInfo(const StoreInst *S, const Location &Loc);
431b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman
432b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  /// getModRefInfo (for stores) - A convenience wrapper.
4332feee6454d4c9cbb3a104b0f593d31a91a14d15aChris Lattner  ModRefResult getModRefInfo(const StoreInst *S, const Value *P, uint64_t Size){
434b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman    return getModRefInfo(S, Location(P, Size));
435b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  }
436fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman
4372bf786af90b8c3826974b2a9deea5e8081ebf113Sean Silva  /// getModRefInfo (for fences) - Return information about whether
4388a552bb85a5e9a6c250c0a899941fbd3ae7b5006Eli Friedman  /// a particular store modifies or reads the specified memory location.
4398a552bb85a5e9a6c250c0a899941fbd3ae7b5006Eli Friedman  ModRefResult getModRefInfo(const FenceInst *S, const Location &Loc) {
4408a552bb85a5e9a6c250c0a899941fbd3ae7b5006Eli Friedman    // Conservatively correct.  (We could possibly be a bit smarter if
4418a552bb85a5e9a6c250c0a899941fbd3ae7b5006Eli Friedman    // Loc is a alloca that doesn't escape.)
4428a552bb85a5e9a6c250c0a899941fbd3ae7b5006Eli Friedman    return ModRef;
4438a552bb85a5e9a6c250c0a899941fbd3ae7b5006Eli Friedman  }
4448a552bb85a5e9a6c250c0a899941fbd3ae7b5006Eli Friedman
4458a552bb85a5e9a6c250c0a899941fbd3ae7b5006Eli Friedman  /// getModRefInfo (for fences) - A convenience wrapper.
4468a552bb85a5e9a6c250c0a899941fbd3ae7b5006Eli Friedman  ModRefResult getModRefInfo(const FenceInst *S, const Value *P, uint64_t Size){
4478a552bb85a5e9a6c250c0a899941fbd3ae7b5006Eli Friedman    return getModRefInfo(S, Location(P, Size));
4488a552bb85a5e9a6c250c0a899941fbd3ae7b5006Eli Friedman  }
4498a552bb85a5e9a6c250c0a899941fbd3ae7b5006Eli Friedman
4502bf786af90b8c3826974b2a9deea5e8081ebf113Sean Silva  /// getModRefInfo (for cmpxchges) - Return information about whether
45155ba816883842e793cdeb32fcb805c4e011b527fEli Friedman  /// a particular cmpxchg modifies or reads the specified memory location.
45246cb5afdcd031c371c78201fb34291d9d48b2ee4Eli Friedman  ModRefResult getModRefInfo(const AtomicCmpXchgInst *CX, const Location &Loc);
45355ba816883842e793cdeb32fcb805c4e011b527fEli Friedman
45455ba816883842e793cdeb32fcb805c4e011b527fEli Friedman  /// getModRefInfo (for cmpxchges) - A convenience wrapper.
45555ba816883842e793cdeb32fcb805c4e011b527fEli Friedman  ModRefResult getModRefInfo(const AtomicCmpXchgInst *CX,
45655ba816883842e793cdeb32fcb805c4e011b527fEli Friedman                             const Value *P, unsigned Size) {
45755ba816883842e793cdeb32fcb805c4e011b527fEli Friedman    return getModRefInfo(CX, Location(P, Size));
45855ba816883842e793cdeb32fcb805c4e011b527fEli Friedman  }
45955ba816883842e793cdeb32fcb805c4e011b527fEli Friedman
4602bf786af90b8c3826974b2a9deea5e8081ebf113Sean Silva  /// getModRefInfo (for atomicrmws) - Return information about whether
46155ba816883842e793cdeb32fcb805c4e011b527fEli Friedman  /// a particular atomicrmw modifies or reads the specified memory location.
46246cb5afdcd031c371c78201fb34291d9d48b2ee4Eli Friedman  ModRefResult getModRefInfo(const AtomicRMWInst *RMW, const Location &Loc);
46355ba816883842e793cdeb32fcb805c4e011b527fEli Friedman
46455ba816883842e793cdeb32fcb805c4e011b527fEli Friedman  /// getModRefInfo (for atomicrmws) - A convenience wrapper.
46555ba816883842e793cdeb32fcb805c4e011b527fEli Friedman  ModRefResult getModRefInfo(const AtomicRMWInst *RMW,
46655ba816883842e793cdeb32fcb805c4e011b527fEli Friedman                             const Value *P, unsigned Size) {
46755ba816883842e793cdeb32fcb805c4e011b527fEli Friedman    return getModRefInfo(RMW, Location(P, Size));
46855ba816883842e793cdeb32fcb805c4e011b527fEli Friedman  }
46955ba816883842e793cdeb32fcb805c4e011b527fEli Friedman
4702bf786af90b8c3826974b2a9deea5e8081ebf113Sean Silva  /// getModRefInfo (for va_args) - Return information about whether
471b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  /// a particular va_arg modifies or reads the specified memory location.
472b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  ModRefResult getModRefInfo(const VAArgInst* I, const Location &Loc);
473b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman
474b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  /// getModRefInfo (for va_args) - A convenience wrapper.
4752feee6454d4c9cbb3a104b0f593d31a91a14d15aChris Lattner  ModRefResult getModRefInfo(const VAArgInst* I, const Value* P, uint64_t Size){
476b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman    return getModRefInfo(I, Location(P, Size));
477b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  }
478fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman
479fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman  /// getModRefInfo - Return information about whether two call sites may refer
480fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman  /// to the same set of memory locations.  See
481fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman  ///   http://llvm.org/docs/AliasAnalysis.html#ModRefInfo
482fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman  /// for details.
483fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman  virtual ModRefResult getModRefInfo(ImmutableCallSite CS1,
484fa6cb8d8211579f1370e80b7bac54ebe3fbe35c8Dan Gohman                                     ImmutableCallSite CS2);
4854df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner
4863a884f5c17ac32e34e7e62b4602a0d73eeda1ce8Chad Rosier  /// callCapturesBefore - Return information about whether a particular call
4873a884f5c17ac32e34e7e62b4602a0d73eeda1ce8Chad Rosier  /// site modifies or reads the specified memory location.
4883a884f5c17ac32e34e7e62b4602a0d73eeda1ce8Chad Rosier  ModRefResult callCapturesBefore(const Instruction *I,
4893a884f5c17ac32e34e7e62b4602a0d73eeda1ce8Chad Rosier                                  const AliasAnalysis::Location &MemLoc,
4903a884f5c17ac32e34e7e62b4602a0d73eeda1ce8Chad Rosier                                  DominatorTree *DT);
4913a884f5c17ac32e34e7e62b4602a0d73eeda1ce8Chad Rosier
4923a884f5c17ac32e34e7e62b4602a0d73eeda1ce8Chad Rosier  /// callCapturesBefore - A convenience wrapper.
4933a884f5c17ac32e34e7e62b4602a0d73eeda1ce8Chad Rosier  ModRefResult callCapturesBefore(const Instruction *I, const Value *P,
4943a884f5c17ac32e34e7e62b4602a0d73eeda1ce8Chad Rosier                                  uint64_t Size, DominatorTree *DT) {
4953a884f5c17ac32e34e7e62b4602a0d73eeda1ce8Chad Rosier    return callCapturesBefore(I, Location(P, Size), DT);
4963a884f5c17ac32e34e7e62b4602a0d73eeda1ce8Chad Rosier  }
4973a884f5c17ac32e34e7e62b4602a0d73eeda1ce8Chad Rosier
498ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner  //===--------------------------------------------------------------------===//
499ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner  /// Higher level methods for querying mod/ref information.
500ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner  ///
501ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner
502f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner  /// canBasicBlockModify - Return true if it is possible for execution of the
503f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner  /// specified basic block to modify the value pointed to by Ptr.
504b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  bool canBasicBlockModify(const BasicBlock &BB, const Location &Loc);
505b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman
506b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  /// canBasicBlockModify - A convenience wrapper.
5073da848bbda62b25c12335998aaa44ab361f0bf15Dan Gohman  bool canBasicBlockModify(const BasicBlock &BB, const Value *P, uint64_t Size){
508b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman    return canBasicBlockModify(BB, Location(P, Size));
509b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  }
5104df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner
511f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner  /// canInstructionRangeModify - Return true if it is possible for the
512f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner  /// execution of the specified instructions to modify the value pointed to by
513f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner  /// Ptr.  The instructions to consider are all of the instructions in the
514f12c2c28bd72091f2d7fff5718265c5ad52e7af8Chris Lattner  /// range of [I1,I2] INCLUSIVE.  I1 and I2 must be in the same basic block.
5154df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner  bool canInstructionRangeModify(const Instruction &I1, const Instruction &I2,
516b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman                                 const Location &Loc);
517b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman
518b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  /// canInstructionRangeModify - A convenience wrapper.
519b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  bool canInstructionRangeModify(const Instruction &I1, const Instruction &I2,
5203da848bbda62b25c12335998aaa44ab361f0bf15Dan Gohman                                 const Value *Ptr, uint64_t Size) {
521b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman    return canInstructionRangeModify(I1, I2, Location(Ptr, Size));
522b2143b6247901ae4eca2192ee134564c4f5f7853Dan Gohman  }
523ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner
524ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner  //===--------------------------------------------------------------------===//
525ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner  /// Methods that clients should call when they transform the program to allow
526ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner  /// alias analyses to update their internal data structures.  Note that these
527ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner  /// methods may be called on any instruction, regardless of whether or not
528ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner  /// they have pointer-analysis implications.
529ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner  ///
530ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner
531ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner  /// deleteValue - This method should be called whenever an LLVM Value is
532ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner  /// deleted from the program, for example when an instruction is found to be
533ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner  /// redundant and is eliminated.
534ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner  ///
535ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner  virtual void deleteValue(Value *V);
536ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner
537ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner  /// copyValue - This method should be used whenever a preexisting value in the
538ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner  /// program is copied or cloned, introducing a new value.  Note that analysis
539ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner  /// implementations should tolerate clients that use this method to introduce
540ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner  /// the same value multiple times: if the analysis already knows about a
541ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner  /// value, it should ignore the request.
542ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner  ///
543ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner  virtual void copyValue(Value *From, Value *To);
544ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner
545ab6acc6ecdc4585a55059e36d81481d1c26d3ff9Owen Anderson  /// addEscapingUse - This method should be used whenever an escaping use is
546ab6acc6ecdc4585a55059e36d81481d1c26d3ff9Owen Anderson  /// added to a pointer value.  Analysis implementations may either return
547ab6acc6ecdc4585a55059e36d81481d1c26d3ff9Owen Anderson  /// conservative responses for that value in the future, or may recompute
548ab6acc6ecdc4585a55059e36d81481d1c26d3ff9Owen Anderson  /// some or all internal state to continue providing precise responses.
549ab6acc6ecdc4585a55059e36d81481d1c26d3ff9Owen Anderson  ///
550ab6acc6ecdc4585a55059e36d81481d1c26d3ff9Owen Anderson  /// Escaping uses are considered by anything _except_ the following:
551ab6acc6ecdc4585a55059e36d81481d1c26d3ff9Owen Anderson  ///  - GEPs or bitcasts of the pointer
552ab6acc6ecdc4585a55059e36d81481d1c26d3ff9Owen Anderson  ///  - Loads through the pointer
553ab6acc6ecdc4585a55059e36d81481d1c26d3ff9Owen Anderson  ///  - Stores through (but not of) the pointer
554ab6acc6ecdc4585a55059e36d81481d1c26d3ff9Owen Anderson  virtual void addEscapingUse(Use &U);
555ab6acc6ecdc4585a55059e36d81481d1c26d3ff9Owen Anderson
556ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner  /// replaceWithNewValue - This method is the obvious combination of the two
557ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner  /// above, and it provided as a helper to simplify client code.
558ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner  ///
559ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner  void replaceWithNewValue(Value *Old, Value *New) {
560ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner    copyValue(Old, New);
561ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner    deleteValue(Old);
562ab8c565768ff7485f40cbb65e2914f9046e743d4Chris Lattner  }
5634df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner};
5644df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner
5651fc18d71deb0e23a9101c87bb7b1455098ce1c09Dan Gohman// Specialize DenseMapInfo for Location.
5661fc18d71deb0e23a9101c87bb7b1455098ce1c09Dan Gohmantemplate<>
5671fc18d71deb0e23a9101c87bb7b1455098ce1c09Dan Gohmanstruct DenseMapInfo<AliasAnalysis::Location> {
5681fc18d71deb0e23a9101c87bb7b1455098ce1c09Dan Gohman  static inline AliasAnalysis::Location getEmptyKey() {
5691fc18d71deb0e23a9101c87bb7b1455098ce1c09Dan Gohman    return
5701fc18d71deb0e23a9101c87bb7b1455098ce1c09Dan Gohman      AliasAnalysis::Location(DenseMapInfo<const Value *>::getEmptyKey(),
571dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines                              0, nullptr);
5721fc18d71deb0e23a9101c87bb7b1455098ce1c09Dan Gohman  }
5731fc18d71deb0e23a9101c87bb7b1455098ce1c09Dan Gohman  static inline AliasAnalysis::Location getTombstoneKey() {
5741fc18d71deb0e23a9101c87bb7b1455098ce1c09Dan Gohman    return
5751fc18d71deb0e23a9101c87bb7b1455098ce1c09Dan Gohman      AliasAnalysis::Location(DenseMapInfo<const Value *>::getTombstoneKey(),
576dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines                              0, nullptr);
5771fc18d71deb0e23a9101c87bb7b1455098ce1c09Dan Gohman  }
5781fc18d71deb0e23a9101c87bb7b1455098ce1c09Dan Gohman  static unsigned getHashValue(const AliasAnalysis::Location &Val) {
5791fc18d71deb0e23a9101c87bb7b1455098ce1c09Dan Gohman    return DenseMapInfo<const Value *>::getHashValue(Val.Ptr) ^
5801fc18d71deb0e23a9101c87bb7b1455098ce1c09Dan Gohman           DenseMapInfo<uint64_t>::getHashValue(Val.Size) ^
5811fc18d71deb0e23a9101c87bb7b1455098ce1c09Dan Gohman           DenseMapInfo<const MDNode *>::getHashValue(Val.TBAATag);
5821fc18d71deb0e23a9101c87bb7b1455098ce1c09Dan Gohman  }
5831fc18d71deb0e23a9101c87bb7b1455098ce1c09Dan Gohman  static bool isEqual(const AliasAnalysis::Location &LHS,
5841fc18d71deb0e23a9101c87bb7b1455098ce1c09Dan Gohman                      const AliasAnalysis::Location &RHS) {
5851fc18d71deb0e23a9101c87bb7b1455098ce1c09Dan Gohman    return LHS.Ptr == RHS.Ptr &&
5861fc18d71deb0e23a9101c87bb7b1455098ce1c09Dan Gohman           LHS.Size == RHS.Size &&
5871fc18d71deb0e23a9101c87bb7b1455098ce1c09Dan Gohman           LHS.TBAATag == RHS.TBAATag;
5881fc18d71deb0e23a9101c87bb7b1455098ce1c09Dan Gohman  }
5891fc18d71deb0e23a9101c87bb7b1455098ce1c09Dan Gohman};
5901fc18d71deb0e23a9101c87bb7b1455098ce1c09Dan Gohman
591a5f81bba4ab18d6129774d4d67495f14b6f64375Dan Gohman/// isNoAliasCall - Return true if this pointer is returned by a noalias
592a5f81bba4ab18d6129774d4d67495f14b6f64375Dan Gohman/// function.
593a5f81bba4ab18d6129774d4d67495f14b6f64375Dan Gohmanbool isNoAliasCall(const Value *V);
594a5f81bba4ab18d6129774d4d67495f14b6f64375Dan Gohman
5959f5de6dadcdb9922ad8c8135a29e4abccec11671Michael Kuperstein/// isNoAliasArgument - Return true if this is an argument with the noalias
5969f5de6dadcdb9922ad8c8135a29e4abccec11671Michael Kuperstein/// attribute.
5979f5de6dadcdb9922ad8c8135a29e4abccec11671Michael Kupersteinbool isNoAliasArgument(const Value *V);
5989f5de6dadcdb9922ad8c8135a29e4abccec11671Michael Kuperstein
5993311a1f8f0d8a2c6d940802bbb95eba0b801a615Dan Gohman/// isIdentifiedObject - Return true if this pointer refers to a distinct and
600a5f81bba4ab18d6129774d4d67495f14b6f64375Dan Gohman/// identifiable object.  This returns true for:
6015753a4a0033da4add45f2e9930a4e1159d92a869Dan Gohman///    Global Variables and Functions (but not Global Aliases)
602c63ee60ef030177fed0fea9212bc2f516fdf0796Dan Gohman///    Allocas
6039e86f4364b912ae743490ba01d6989acfd12c046Dan Gohman///    ByVal and NoAlias Arguments
604c63ee60ef030177fed0fea9212bc2f516fdf0796Dan Gohman///    NoAlias returns (e.g. calls to malloc)
6053311a1f8f0d8a2c6d940802bbb95eba0b801a615Dan Gohman///
6069e86f4364b912ae743490ba01d6989acfd12c046Dan Gohmanbool isIdentifiedObject(const Value *V);
6073311a1f8f0d8a2c6d940802bbb95eba0b801a615Dan Gohman
6084f1bd9e9963239c119db70070db1d68286b3de7eReid Spencer} // End llvm namespace
6094f1bd9e9963239c119db70070db1d68286b3de7eReid Spencer
6104df22c0100fe27f19e6f4874f24eedd0742b9cf4Chris Lattner#endif
611