[llvm-branch-commits] [mlir] [mlir][LLVM] Use a disjoint scope domain when inlining noalias (PR #218773)

Krzysztof Drewniak via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Aug 26 08:07:07 PDT 2026


================
@@ -408,19 +396,34 @@ static void createNewAliasScopesFromNoAliasParameter(
       // Call operations are included in this list since we do not know whether
       // the callee accesses any memory besides the ones passed as its
       // arguments.
-      if (aliasesOtherKnownObject ||
-          isa<LLVM::CallOp>(aliasInterface.getOperation()))
-        return;
-
       SmallVector<Attribute> aliasScopes;
-      for (LLVM::SSACopyOp noAlias : noAliasParams)
-        if (basedOnPointers.contains(noAlias))
-          aliasScopes.push_back(pointerScopes[noAlias]);
+      if (!aliasesOtherKnownObject &&
+          !isa<LLVM::CallOp>(aliasInterface.getOperation()))
+        for (LLVM::SSACopyOp noAlias : noAliasParams)
+          if (basedOnPointers.contains(noAlias))
+            aliasScopes.push_back(pointerScopes[noAlias]);
 
-      if (!aliasScopes.empty())
+      if (!aliasScopes.empty()) {
         aliasInterface.setAliasScopes(
             concatArrayAttr(aliasInterface.getAliasScopesOrNull(),
                             ArrayAttr::get(call->getContext(), aliasScopes)));
+        return;
----------------
krzysz00 wrote:

Nope! That's the whole point of a domain with disjoint scopes - all you list is what scopes you're in, and, by definition, you're noalias with the rest of them

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


More information about the llvm-branch-commits mailing list