Skip to content

Commit 88bbf68

Browse files
Improve asserts
1 parent 74e3ea8 commit 88bbf68

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

mlir/lib/Transforms/Utils/DialectConversion.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2835,8 +2835,7 @@ Value TypeConverter::materializeTargetConversion(OpBuilder &builder,
28352835
builder, loc, TypeRange(resultType), inputs, originalType);
28362836
if (result.empty())
28372837
return nullptr;
2838-
assert(result.size() == 1 && "requested 1:1 materialization, but callback "
2839-
"produced 1:N materialization");
2838+
assert(result.size() == 1 && "expected single result");
28402839
return result.front();
28412840
}
28422841

@@ -2849,6 +2848,9 @@ SmallVector<Value> TypeConverter::materializeTargetConversion(
28492848
fn(builder, resultTypes, inputs, loc, originalType);
28502849
if (result.empty())
28512850
continue;
2851+
assert(TypeRange(result) == resultTypes &&
2852+
"callback produced incorrect number of values or values with "
2853+
"incorrect types");
28522854
return result;
28532855
}
28542856
return {};

0 commit comments

Comments
 (0)