[Mlir-commits] [mlir] [mlir][Transforms] Dialect conversion: Context-aware type conversions (PR #140434)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sun May 18 18:39:01 PDT 2025


================
@@ -2899,6 +2899,28 @@ LogicalResult TypeConverter::convertType(Type t,
   return failure();
 }
 
+LogicalResult TypeConverter::convertType(Value v,
+                                         SmallVectorImpl<Type> &results) const {
+  assert(v && "expected non-null value");
+
+  // If this type converter does not have context-aware type conversions, call
+  // the type-based overload, which has caching.
+  if (!hasContextAwareTypeConversions) {
+    return convertType(v.getType(), results);
+  }
----------------
cchen435 wrote:

Can `convertType(Value value)` always attempt the context-aware first, and rollback to context-unaware if failed? In such case, users have the responsibility to determine whether a value will go with context-ware or not in `addConversion(Value value)`.  

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


More information about the Mlir-commits mailing list