[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);
+
+ // Each access is implicitly noalias with every scope of such a domain it is
+ // not itself in, so the accesses don't alias if, for some domain, they have
+ // no scope in common.
----------------
brunodf-gf wrote:
More precise: "the accesses don't alias if, for some domain, both accesses use one or more of its scopes, but they have none of its scopes in common"
(Note how you are formulating the noalias constraint that you are _actually_ implementing here.)
https://github.com/llvm/llvm-project/pull/218768
More information about the llvm-branch-commits
mailing list