[Mlir-commits] [mlir] [mlir] Add `convertInstruction` and `getSupportedInstructions` to `LLVMImportInterface` (PR #86799)

Tobias Gysi llvmlistbot at llvm.org
Wed Mar 27 08:56:00 PDT 2024


================
@@ -100,9 +114,27 @@ class LLVMImportInterface
                           *it, iface.getDialect()->getNamespace(),
                           intrinsicToDialect.lookup(*it)->getNamespace()));
       }
+      const auto *instIt =
+          llvm::find_if(iface.getSupportedInstructions(), [&](unsigned id) {
+            return instructionToDialect.count(id);
+          });
+      if (instIt != iface.getSupportedInstructions().end()) {
+        return emitError(
+            UnknownLoc::get(iface.getContext()),
+            llvm::formatv(
+                "expected unique conversion for instruction ({0}), but "
+                "got conflicting {1} and {2} conversions",
+                *it, iface.getDialect()->getNamespace(),
+                instructionToDialect.lookup(*it)
----------------
gysit wrote:

```suggestion
                *instIt, iface.getDialect()->getNamespace(),
                instructionToDialect.lookup(*instIt)
```
I believe this is the intrinsic iterator? Maybe rename the iterator above to `intrIt` or so that it is more obvious if things are mixed up?

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


More information about the Mlir-commits mailing list