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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 9 09:00:45 PST 2024


================
@@ -317,62 +262,67 @@ AliasSet *AliasSetTracker::findAliasSetForUnknownInst(Instruction *Inst) {
 }
 
 AliasSet &AliasSetTracker::getAliasSetFor(const MemoryLocation &MemLoc) {
+  // The alias sets are indexed with a map from the memory locations' pointer
+  // values. If the memory location is already registered, we can find it in the
+  // alias set associated with its pointer.
+  AliasSet *&MapEntry = PointerMap[MemLoc.Ptr];
+  if (MapEntry) {
+    AliasSet *AS = MapEntry->getForwardedTarget(*this);
+    if (llvm::is_contained(AS->MemoryLocs, MemLoc)) {
+      if (AS != MapEntry) {
+        AS->addRef();
+        MapEntry->dropRef(*this);
+        MapEntry = AS;
+      }
----------------
nikic wrote:

Is this bit of code an optimization to avoid following forwards on the next lookup?

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


More information about the llvm-commits mailing list