[Mlir-commits] [mlir] [mlir][Transforms] Dialect conversion: Fix missing source materialization (PR #97903)
Matthias Springer
llvmlistbot at llvm.org
Sat Jul 13 06:45:18 PDT 2024
================
@@ -2865,6 +2860,8 @@ static LogicalResult legalizeUnresolvedMaterialization(
break;
}
if (newMaterialization) {
+ assert(newMaterialization.getType() == opResult.getType() &&
+ "materialization callback produced value of incorrect type");
----------------
matthias-springer wrote:
`source type system` is not really the correct word. In case of an argument materialization, we have to produce an SSA value of the original type. That original type could an illegal type, but it could also be a legal type. (It is triggered by the user through `applySignatureConversion` and it is possible to convert a signature that's already legal.)
I clarified the comment in the type converter a bit.
> Another alternative would be to insert the cast here, if the types don't match.
That would work indeed but we also don't insert `unrealized_conversion_cast` during `RewriterBase::replaceOp` when the types of the replacement values do not match.
https://github.com/llvm/llvm-project/pull/97903
More information about the Mlir-commits
mailing list