[Mlir-commits] [mlir] [mlir] fix dialect conversion with no type converter (PR #123154)

Maksim Levental llvmlistbot at llvm.org
Wed Jan 15 20:41:00 PST 2025


https://github.com/makslevental updated https://github.com/llvm/llvm-project/pull/123154

>From 03690057a9d4330d2c10fe0d4977fbea964d506f Mon Sep 17 00:00:00 2001
From: max <maksim.levental at gmail.com>
Date: Wed, 15 Jan 2025 23:16:32 -0500
Subject: [PATCH] [mlir] fix dialect conversion with no type converter

---
 mlir/lib/Transforms/Utils/DialectConversion.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp
index 403321d40d53c9..4f56fb805f04aa 100644
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -208,7 +208,7 @@ ConversionValueMapping::lookupOrDefault(Value from,
         next.push_back(v);
       }
     }
-    if (next != current) {
+    if (!desiredTypes.empty() && next != current) {
       // If at least one value was replaced, continue the lookup from there.
       current = std::move(next);
       continue;
@@ -223,7 +223,7 @@ ConversionValueMapping::lookupOrDefault(Value from,
     // we choose to reuse existing IR (when possible) instead of creating it
     // multiple times.
     auto it = mapping.find(current);
-    if (it == mapping.end()) {
+    if (it == mapping.end() || desiredTypes.empty()) {
       // No mapping found: The lookup stops here.
       break;
     }



More information about the Mlir-commits mailing list