[polly] [llvm] [AST] Don't merge memory locations in AliasSetTracker (PR #65731)

Bruno De Fraine via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 22 13:51:41 PST 2023


================
@@ -246,42 +191,54 @@ ModRefInfo AliasSet::aliasesUnknownInst(const Instruction *Inst,
   }
 
   ModRefInfo MR = ModRefInfo::NoModRef;
-  for (iterator I = begin(), E = end(); I != E; ++I) {
-    MR |= AA.getModRefInfo(
-        Inst, MemoryLocation(I.getPointer(), I.getSize(), I.getAAInfo()));
+  for (const auto &ASMemLoc : MemoryLocs) {
+    MR |= AA.getModRefInfo(Inst, ASMemLoc);
     if (isModAndRefSet(MR))
       return MR;
   }
 
   return MR;
 }
 
-void AliasSetTracker::clear() {
-  // Delete all the PointerRec entries.
-  for (auto &I : PointerMap)
-    I.second->eraseFromList();
+AliasSet::PointerVector AliasSet::getPointers() const {
+  // To deduplicate pointer values, use a linear scan if the number of elements
+  // is small, or a set if large. This is the same idea as SmallSetVector. In
+  // addition, we can allocate space for the result vector upfront.
+  PointerVector Result;
+  if (MemoryLocs.size() <= Result.capacity()) {
+    for (const MemoryLocation &MemLoc : MemoryLocs)
+      if (llvm::find(Result, MemLoc.Ptr) == Result.end())
----------------
brunodf-snps wrote:

Code removed in commit efc787bc5d61.

https://github.com/llvm/llvm-project/pull/65731


More information about the llvm-commits mailing list