[llvm-branch-commits] [clang] [llvm] [mlir] [polly] [IR] Add alias scope domains with disjoint scopes (PR #218768)

Bruno De Fraine via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Aug 27 02:59:29 PDT 2026


================
@@ -176,6 +204,37 @@ bool ScopedNoAliasAAResult::mayAliasInScopes(const MDNode *Scopes,
   return true;
 }
 
+bool ScopedNoAliasAAResult::mayAliasInDisjointDomains(const MDNode *Scopes1,
+                                                      const MDNode *Scopes2) {
+  if (!Scopes1 || !Scopes2)
+    return true;
+
+  // Collect the domains with disjoint scopes that the first access is in.
+  SmallPtrSet<const MDNode *, 16> Domains;
+  for (const MDOperand &MDOp : Scopes1->operands())
+    if (const MDNode *MD = dyn_cast<MDNode>(MDOp))
+      if (const MDNode *Domain = AliasScopeNode(MD).getDomain())
+        if (AliasScopeDomainNode(Domain).hasDisjointScopes())
+          Domains.insert(Domain);
----------------
brunodf-gf wrote:

This logic could be shared with `collectScopedDomains` above, it is very similar?

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


More information about the llvm-branch-commits mailing list