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

Tobias Gysi via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Aug 26 00:09:05 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;
+      }
+
+      // Add all noalias parameter scopes to the noalias scope list that we are
+      // not based on.
----------------
gysit wrote:

This path is the taken for operations that for example are based on an underlying alloca or another memory object that cannot alias with the noalias pointers?

If I am correct with my assumptions it would be could to encode this in a comment?

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


More information about the llvm-branch-commits mailing list