[Mlir-commits] [mlir] [MLIR] Enable import of non self referential alias scopes (PR #121987)

William Moses llvmlistbot at llvm.org
Tue Jan 7 13:49:16 PST 2025


================
@@ -427,6 +427,13 @@ ModuleImport::processAliasScopeMetadata(const llvm::MDNode *node) {
     return node->getNumOperands() != 0 &&
            node == dyn_cast<llvm::MDNode>(node->getOperand(0));
   };
+  auto verifySelfRefOrString = [](const llvm::MDNode *node) {
+    if (node->getNumOperands() != 0 &&
+           node == dyn_cast<llvm::MDNode>(node->getOperand(0)))
+      return true;
+    return node->getNumOperands() != 0 &&
+           isa<llvm::MDNode>(node->getOperand(0));
+  };
----------------
wsmoses wrote:

so I tried that originally, but then it forced the closure to be captured which feels nonideal.

I also realized this could be greatly simplified since we can fuse the two checks into one (e.g. check if operands != 0 and (either its a self ref, or mdstring)

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


More information about the Mlir-commits mailing list