Skip to content

Commit 43edbab

Browse files
address comments
1 parent 88bbf68 commit 43edbab

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

mlir/include/mlir/Transforms/DialectConversion.h

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -435,15 +435,20 @@ class TypeConverter {
435435
// directly.
436436
result = callback(builder, resultTypes, inputs, loc, originalType);
437437
} else if constexpr (std::is_assignable<Type, T>::value) {
438-
// This is a 1:1 target materialization. Invoke it only if the result
439-
// type class of the callback matches the requested result type.
440-
if (T derivedType = dyn_cast<T>(resultTypes.front())) {
441-
// 1:1 materializations produce single values, but we store 1:N
442-
// target materialization functions in the type converter. Wrap the
443-
// result value in a SmallVector<Value>.
444-
Value val = callback(builder, derivedType, inputs, loc, originalType);
445-
if (val)
446-
result.push_back(val);
438+
// This is a 1:1 target materialization. Invoke the callback only if a
439+
// single SSA value is requested.
440+
if (resultTypes.size() == 1) {
441+
// Invoke the callback only if the type class of the callback matches
442+
// the requested result type.
443+
if (T derivedType = dyn_cast<T>(resultTypes.front())) {
444+
// 1:1 materializations produce single values, but we store 1:N
445+
// target materialization functions in the type converter. Wrap the
446+
// result value in a SmallVector<Value>.
447+
Value val =
448+
callback(builder, derivedType, inputs, loc, originalType);
449+
if (val)
450+
result.push_back(val);
451+
}
447452
}
448453
} else {
449454
static_assert(sizeof(T) == 0, "T must be a Type or a TypeRange");

0 commit comments

Comments
 (0)