[Mlir-commits] [mlir] [mlir][Transforms] Dialect conversion: Add missing "else if" branch (PR #101148)

Matthias Springer llvmlistbot at llvm.org
Wed Jul 31 03:14:06 PDT 2024


================
@@ -1328,15 +1328,19 @@ Block *ConversionPatternRewriterImpl::applySignatureConversion(
     mapping.map(origArg, argMat);
     appendRewrite<ReplaceBlockArgRewrite>(block, origArg);
----------------
matthias-springer wrote:

There are two mapping steps: `origArg -> argMat -> targetMat`. Note that the mapping is *not* overwritten here. In the second step, we map `argMat`, not `origArg`.

And we also generate two `unrealized_conversion_cast` ops. Such casts cannot be folded, unless they `type(origArg) == type(targetMat)`.

It was actually on purpose that two casts in a row are generated here. The first one is an argument materialization and the second one is target materialization. Depending on the configuration of the type converter, we may not generate `unrealized_conversion_cast`, but custom ops.


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


More information about the Mlir-commits mailing list