[PATCH] D53836: [AliasSetTracker] Cleanup addPointer interface. [NFCI]

Alina Sbirlea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 29 14:50:08 PDT 2018


asbirlea created this revision.
asbirlea added reviewers: reames, mkazantsev.
Herald added subscribers: jlebar, sanjoy.

Attempting to simplify the addPointer interface.
Currently there's code decomposing a MemoryLocation into (Ptr, Size, AAMDNodes) only to recreate the MemoryLocation inside the call.


Repository:
  rL LLVM

https://reviews.llvm.org/D53836

Files:
  include/llvm/Analysis/AliasSetTracker.h
  lib/Analysis/AliasSetTracker.cpp


Index: lib/Analysis/AliasSetTracker.cpp
===================================================================
--- lib/Analysis/AliasSetTracker.cpp
+++ lib/Analysis/AliasSetTracker.cpp
@@ -383,7 +383,7 @@
 
 void AliasSetTracker::add(Value *Ptr, LocationSize Size,
                           const AAMDNodes &AAInfo) {
-  addPointer(Ptr, Size, AAInfo, AliasSet::NoAccess);
+  addPointer(MemoryLocation(Ptr, Size, AAInfo), AliasSet::NoAccess);
 }
 
 void AliasSetTracker::add(LoadInst *LI) {
@@ -518,8 +518,9 @@
 
     // Loop over all of the pointers in this alias set.
     for (AliasSet::iterator ASI = AS.begin(), E = AS.end(); ASI != E; ++ASI)
-      addPointer(ASI.getPointer(), ASI.getSize(), ASI.getAAInfo(),
-                 (AliasSet::AccessLattice)AS.Access);
+      addPointer(
+          MemoryLocation(ASI.getPointer(), ASI.getSize(), ASI.getAAInfo()),
+          (AliasSet::AccessLattice)AS.Access);
   }
 }
 
@@ -620,10 +621,9 @@
   return *AliasAnyAS;
 }
 
-AliasSet &AliasSetTracker::addPointer(Value *P, LocationSize Size,
-                                      const AAMDNodes &AAInfo,
+AliasSet &AliasSetTracker::addPointer(MemoryLocation Loc,
                                       AliasSet::AccessLattice E) {
-  AliasSet &AS = getAliasSetFor(MemoryLocation(P, Size, AAInfo));
+  AliasSet &AS = getAliasSetFor(Loc);
   AS.Access |= E;
 
   if (!AliasAnyAS && (TotalMayAliasSetSize > SaturationThreshold)) {
Index: include/llvm/Analysis/AliasSetTracker.h
===================================================================
--- include/llvm/Analysis/AliasSetTracker.h
+++ include/llvm/Analysis/AliasSetTracker.h
@@ -442,12 +442,7 @@
     return *Entry;
   }
 
-  AliasSet &addPointer(Value *P, LocationSize Size, const AAMDNodes &AAInfo,
-                       AliasSet::AccessLattice E);
-  AliasSet &addPointer(MemoryLocation Loc,
-                       AliasSet::AccessLattice E) {
-    return addPointer(const_cast<Value*>(Loc.Ptr), Loc.Size, Loc.AATags, E);
-  }
+  AliasSet &addPointer(MemoryLocation Loc, AliasSet::AccessLattice E);
   AliasSet *mergeAliasSetsForPointer(const Value *Ptr, LocationSize Size,
                                      const AAMDNodes &AAInfo);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53836.171579.patch
Type: text/x-patch
Size: 2201 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181029/5401defc/attachment.bin>


More information about the llvm-commits mailing list