[llvm] [AMDGPU] Correctly merge noalias scopes during lowering of LDS data. (PR #131664)

Sirish Pande via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 10 11:02:08 PDT 2025


================
@@ -114,17 +114,26 @@ static void collectMDInDomain(const MDNode *List, const MDNode *Domain,
         Nodes.insert(MD);
 }
 
+/// Collect the set of scoped domains relevant to the noalias scopes.
+void ScopedNoAliasAAResult::collectScopedDomains(
+    const MDNode *NoAlias, SmallPtrSetImpl<const MDNode *> &Domains) const {
+  if (!NoAlias)
+    return;
+  assert(Domains.empty() && "Domains should be empty");
+  for (const MDOperand &MDOp : NoAlias->operands())
+    if (const MDNode *NAMD = dyn_cast<MDNode>(MDOp))
+      if (const MDNode *Domain = AliasScopeNode(NAMD).getDomain())
+        Domains.insert(Domain);
----------------
srpande wrote:

Domains is defined as a set prior to this change. This patch just outlines this code into a different function such that it could be used in multiple places in compiler. 

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


More information about the llvm-commits mailing list