@@ -435,15 +435,20 @@ class TypeConverter {
435
435
// directly.
436
436
result = callback (builder, resultTypes, inputs, loc, originalType);
437
437
} 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
+ }
447
452
}
448
453
} else {
449
454
static_assert (sizeof (T) == 0 , " T must be a Type or a TypeRange" );
0 commit comments