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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 22 07:31:32 PST 2023


================
@@ -46,30 +46,29 @@ void AliasSet::mergeSetIn(AliasSet &AS, AliasSetTracker &AST,
   assert(!AS.Forward && "Alias set is already forwarding!");
   assert(!Forward && "This set is a forwarding set!!");
 
-  bool WasMustAlias = (Alias == SetMustAlias);
   // Update the alias and access types of this set...
   Access |= AS.Access;
   Alias  |= AS.Alias;
 
   if (Alias == SetMustAlias) {
-    // Check that these two merged sets really are must aliases.  Since both
-    // used to be must-alias sets, we can just check any pointer from each set
-    // for aliasing.
-    PointerRec *L = getSomePointer();
-    PointerRec *R = AS.getSomePointer();
-
+    // Check that these two merged sets really are must aliases.
     // If the pointers are not a must-alias pair, this set becomes a may alias.
-    if (!BatchAA.isMustAlias(
-            MemoryLocation(L->getValue(), L->getSize(), L->getAAInfo()),
-            MemoryLocation(R->getValue(), R->getSize(), R->getAAInfo())))
-      Alias = SetMayAlias;
+    [&] {
+      for (const MemoryLocation &MemLoc : *this)
+        for (const MemoryLocation &ASMemLoc : AS)
+          if (!BatchAA.isMustAlias(MemLoc, ASMemLoc)) {
----------------
nikic wrote:

Wouldn't it be sufficient to check that *any* pair is MustAlias?

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


More information about the llvm-commits mailing list