Add a convenient form of AliasAnalysis::alias for the case where the sizes
authorDan Gohman <gohman@apple.com>
Tue, 3 Aug 2010 00:56:30 +0000 (00:56 +0000)
committerDan Gohman <gohman@apple.com>
Tue, 3 Aug 2010 00:56:30 +0000 (00:56 +0000)
are unknown.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110090 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/AliasAnalysis.h
lib/Analysis/Lint.cpp
lib/Analysis/MemoryDependenceAnalysis.cpp

index e611a35fc9839cf5bbd881bb3ea434f0d4b1ccb0..e0068dc7b20537e9e21603df21afc8042fe74aac 100644 (file)
@@ -94,6 +94,11 @@ public:
   virtual AliasResult alias(const Value *V1, unsigned V1Size,
                             const Value *V2, unsigned V2Size);
 
+  /// alias - A convenience wrapper for the case where the sizes are unknown.
+  AliasResult alias(const Value *V1, const Value *V2) {
+    return alias(V1, ~0u, V2, ~0u);
+  }
+
   /// isNoAlias - A trivial helper function to check to see if the specified
   /// pointers are no-alias.
   bool isNoAlias(const Value *V1, unsigned V1Size,
index 5624430332a37f972b89e316931b920cc88ddeef..fe01fd7b222987863265643a177e131cc8026f9a 100644 (file)
@@ -246,8 +246,7 @@ void Lint::visitCallSite(CallSite CS) {
         // where nothing is known.
         if (Formal->hasNoAliasAttr() && Actual->getType()->isPointerTy())
           for (CallSite::arg_iterator BI = CS.arg_begin(); BI != AE; ++BI) {
-            Assert1(AI == BI ||
-                    AA->alias(*AI, ~0u, *BI, ~0u) != AliasAnalysis::MustAlias,
+            Assert1(AI == BI || AA->alias(*AI, *BI) != AliasAnalysis::MustAlias,
                     "Unusual: noalias argument aliases another argument", &I);
           }
 
index 4c3cf804d5ccc00a8cbc3b1853cea2de11fb1445..e97bc3b6727c6e8de3ca0b98a1a053cf9ca0cb3a 100644 (file)
@@ -195,8 +195,7 @@ getPointerDependencyFrom(Value *MemPtr, uint64_t MemSize, bool isLoad,
         // FIXME: This only considers queries directly on the invariant-tagged
         // pointer, not on query pointers that are indexed off of them.  It'd
         // be nice to handle that at some point.
-        AliasAnalysis::AliasResult R = 
-          AA->alias(II->getArgOperand(2), ~0U, MemPtr, ~0U);
+        AliasAnalysis::AliasResult R = AA->alias(II->getArgOperand(2), MemPtr);
         if (R == AliasAnalysis::MustAlias) {
           InvariantTag = II->getArgOperand(0);
           continue;
@@ -208,8 +207,7 @@ getPointerDependencyFrom(Value *MemPtr, uint64_t MemSize, bool isLoad,
         // FIXME: This only considers queries directly on the invariant-tagged
         // pointer, not on query pointers that are indexed off of them.  It'd
         // be nice to handle that at some point.
-        AliasAnalysis::AliasResult R =
-          AA->alias(II->getArgOperand(1), ~0U, MemPtr, ~0U);
+        AliasAnalysis::AliasResult R = AA->alias(II->getArgOperand(1), MemPtr);
         if (R == AliasAnalysis::MustAlias)
           return MemDepResult::getDef(II);
       }