[llvm-commits] CVS: llvm/include/llvm/Analysis/AliasAnalysis.h

Chris Lattner lattner at cs.uiuc.edu
Fri Jan 30 16:16:01 PST 2004


Changes in directory llvm/include/llvm/Analysis:

AliasAnalysis.h updated: 1.8 -> 1.9

---
Log message:

Add a new pointsToConstantMemory method to the AliasAnalysis interface
which can be implemented to improve the quality of mod-ref information.


---
Diffs of the changes:  (+8 -1)

Index: llvm/include/llvm/Analysis/AliasAnalysis.h
diff -u llvm/include/llvm/Analysis/AliasAnalysis.h:1.8 llvm/include/llvm/Analysis/AliasAnalysis.h:1.9
--- llvm/include/llvm/Analysis/AliasAnalysis.h:1.8	Wed Dec 10 23:05:02 2003
+++ llvm/include/llvm/Analysis/AliasAnalysis.h	Fri Jan 30 16:15:41 2004
@@ -95,6 +95,11 @@
   ///
   virtual void getMustAliases(Value *P, std::vector<Value*> &RetVals) {}
 
+  /// pointsToConstantMemory - If the specified pointer is known to point into
+  /// constant global memory, return true.  This allows disambiguation of store
+  /// instructions from constant pointers.
+  ///
+  virtual bool pointsToConstantMemory(const Value *P) { return false; }
 
   //===--------------------------------------------------------------------===//
   /// Simple mod/ref information...
@@ -114,7 +119,9 @@
   /// pointer.
   ///
   virtual ModRefResult getModRefInfo(CallSite CS, Value *P, unsigned Size) {
-    return ModRef;
+    // If P points to a constant memory location, the call definitely could not
+    // modify the memory location.
+    return pointsToConstantMemory(P) ? Ref : ModRef;
   }
 
   /// getModRefInfo - Return information about whether two call sites may refer





More information about the llvm-commits mailing list