[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
Wed Sep 30 02:00:55 PDT 2026


================
@@ -5980,23 +5981,63 @@ bool InstCombinerImpl::run() {
 class AliasScopeTracker {
   SmallPtrSet<const MDNode *, 8> UsedAliasScopesAndLists;
   SmallPtrSet<const MDNode *, 8> UsedNoAliasScopesAndLists;
+  // Scopes used by every !alias.scope list that scopes from a disjoint-scope
+  // domain appears in. This is used to catch scopes that don't actually make
+  // anything noalias.
+  SmallDenseMap<const MDNode *, SmallPtrSet<const MDNode *, 4>, 4>
+      CommonScopesOfDisjointDomain;
+
+  // Record, for each disjoint-scope domain \p ScopeList uses, which of its
+  // scopes are used by \p ScopeList, adding to a running intersection.
+  void recordDisjointDomainScopes(const MDNode *ScopeList) {
+    SmallDenseMap<const MDNode *, SmallPtrSet<const MDNode *, 4>, 4> UsedScopes;
+    for (const MDOperand &MDOperand : ScopeList->operands()) {
+      const auto *MDScope = dyn_cast<MDNode>(MDOperand);
+      if (!MDScope)
+        continue;
----------------
brunodf-gf wrote:

Is this needed? `Verifier::visitAliasScopeListMetadata` ensures that a scope list consists of only `MDNode` objects.

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


More information about the llvm-commits mailing list