[llvm-commits] [llvm] r116767 - in /llvm/trunk: include/llvm/Analysis/AliasSetTracker.h lib/Analysis/AliasSetTracker.cpp

Dan Gohman gohman at apple.com
Mon Oct 18 16:31:47 PDT 2010


Author: djg
Date: Mon Oct 18 18:31:47 2010
New Revision: 116767

URL: http://llvm.org/viewvc/llvm-project?rev=116767&view=rev
Log:
Make the representation of AliasSets explicitly differentiate
between "not known yet" and "known no tbaa info" so that it
can merge them properly.

Modified:
    llvm/trunk/include/llvm/Analysis/AliasSetTracker.h
    llvm/trunk/lib/Analysis/AliasSetTracker.cpp

Modified: llvm/trunk/include/llvm/Analysis/AliasSetTracker.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/AliasSetTracker.h?rev=116767&r1=116766&r2=116767&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/AliasSetTracker.h (original)
+++ llvm/trunk/include/llvm/Analysis/AliasSetTracker.h Mon Oct 18 18:31:47 2010
@@ -44,7 +44,8 @@
     const MDNode *TBAAInfo;
   public:
     PointerRec(Value *V)
-      : Val(V), PrevInList(0), NextInList(0), AS(0), Size(0), TBAAInfo(0) {}
+      : Val(V), PrevInList(0), NextInList(0), AS(0), Size(0),
+        TBAAInfo(DenseMapInfo<const MDNode *>::getEmptyKey()) {}
 
     Value *getValue() const { return Val; }
     
@@ -59,26 +60,22 @@
     void updateSizeAndTBAAInfo(unsigned NewSize, const MDNode *NewTBAAInfo) {
       if (NewSize > Size) Size = NewSize;
 
-      if (!TBAAInfo)
+      if (TBAAInfo == DenseMapInfo<const MDNode *>::getEmptyKey())
+        // We don't have a TBAAInfo yet. Set it to NewTBAAInfo.
         TBAAInfo = NewTBAAInfo;
       else if (TBAAInfo != NewTBAAInfo)
-        TBAAInfo = reinterpret_cast<const MDNode *>(-1);
+        // NewTBAAInfo conflicts with TBAAInfo.
+        TBAAInfo = DenseMapInfo<const MDNode *>::getTombstoneKey();
     }
 
     unsigned getSize() const { return Size; }
 
-    /// getRawTBAAInfo - Return the raw TBAAInfo member. In addition to
-    /// being null or a pointer to an MDNode, this could be -1, meaning
-    /// there was conflicting information.
-    const MDNode *getRawTBAAInfo() const {
-      return TBAAInfo;
-    }
-
     /// getTBAAInfo - Return the TBAAInfo, or null if there is no
     /// information or conflicting information.
     const MDNode *getTBAAInfo() const {
-      // If we have conflicting TBAAInfo, return null.
-      if (TBAAInfo == reinterpret_cast<const MDNode *>(-1))
+      // If we have missing or conflicting TBAAInfo, return null.
+      if (TBAAInfo == DenseMapInfo<const MDNode *>::getEmptyKey() ||
+          TBAAInfo == DenseMapInfo<const MDNode *>::getTombstoneKey())
         return 0;
       return TBAAInfo;
     }
@@ -209,7 +206,6 @@
 
     Value *getPointer() const { return CurNode->getValue(); }
     unsigned getSize() const { return CurNode->getSize(); }
-    const MDNode *getRawTBAAInfo() const { return CurNode->getRawTBAAInfo(); }
     const MDNode *getTBAAInfo() const { return CurNode->getTBAAInfo(); }
 
     iterator& operator++() {                // Preincrement

Modified: llvm/trunk/lib/Analysis/AliasSetTracker.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasSetTracker.cpp?rev=116767&r1=116766&r2=116767&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/AliasSetTracker.cpp (original)
+++ llvm/trunk/lib/Analysis/AliasSetTracker.cpp Mon Oct 18 18:31:47 2010
@@ -377,7 +377,7 @@
     bool X;
     for (AliasSet::iterator ASI = AS.begin(), E = AS.end(); ASI != E; ++ASI) {
       AliasSet &NewAS = addPointer(ASI.getPointer(), ASI.getSize(),
-                                   ASI.getRawTBAAInfo(),
+                                   ASI.getTBAAInfo(),
                                    (AliasSet::AccessType)AS.AccessTy, X);
       if (AS.isVolatile()) NewAS.setVolatile();
     }
@@ -533,7 +533,7 @@
   I = PointerMap.find(From);
   AliasSet *AS = I->second->getAliasSet(*this);
   AS->addPointer(*this, Entry, I->second->getSize(),
-                 I->second->getRawTBAAInfo(),
+                 I->second->getTBAAInfo(),
                  true);
 }
 





More information about the llvm-commits mailing list