[Mlir-commits] [mlir] [mlir][ods] Verify access to operands in inferReturnTypes (PR #112574)

Nikolay Panchenko llvmlistbot at llvm.org
Wed Oct 16 15:26:32 PDT 2024


================
@@ -3583,6 +3583,22 @@ void OpEmitter::genTypeInterfaceMethods() {
   fctx.addSubst("_ctxt", "context");
   body << "  ::mlir::Builder odsBuilder(context);\n";
 
+  // Preprocessing stage to verify all accesses to operands are valid.
+  int maxAccessedIndex = -1;
+  for (int i = 0, e = op.getNumResults(); i != e; ++i) {
+    const InferredResultType &infer = op.getInferredResultType(i);
+    if (!infer.isArg())
+      continue;
+    auto arg = op.getArgToOperandOrAttribute(infer.getIndex());
----------------
npanchen wrote:

Apparently, even `getArgToOperandOrAttribute ` is declared with `auto`, so no one wants to expose return type.

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


More information about the Mlir-commits mailing list