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

Bruno De Fraine via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 15:53:18 PDT 2026


================
@@ -1156,6 +1156,20 @@ void llvm::cloneNoAliasScopes(ArrayRef<MDNode *> NoAliasDeclScopes,
                               StringRef Ext, LLVMContext &Context) {
   MDBuilder MDB(Context);
 
+  // A cloned scope has to go into a clone of its domain if that domain has
+  // disjoint scopes: the copies of a duplicated access are in the same memory
+  // region, so they must not become implicitly noalias with each other.
+  DenseMap<const MDNode *, MDNode *> ClonedDomains;
+  auto GetClonedDomain = [&](const MDNode *Domain) {
+    if (!Domain || !AliasScopeDomainNode(Domain).hasDisjointScopes())
----------------
brunodf-gf wrote:

While `AliasScopeNode::getDomain` is written as if it could return nullptr, the Verifier guarantees that a scope has a domain? So I find this `!Domain ||` part distracting.

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


More information about the llvm-commits mailing list