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

Bruno De Fraine via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 25 14:52:07 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)) {
----------------
brunodf-snps wrote:

OK, I think I was too strict. The [definition of MustAlias](https://github.com/llvm/llvm-project/blob/061e4f24b24a3b59d73a94dc6f2f0d21a2b7beac/llvm/docs/AliasAnalysis.rst?plain=1#L138-L140) seems indeed transitive, so any must-alias pair is sufficient (even if the alias queries do not necessarily return must-alias for all pairs).

Updated in commit 5f82129f98f2.

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


More information about the llvm-commits mailing list