[Mlir-commits] [mlir] [mlir][Transforms] Dialect conversion: Add missing "else if" branch (PR #101148)
Adrian Kuegel
llvmlistbot at llvm.org
Wed Jul 31 02:49:08 PDT 2024
akuegel wrote:
We got a failing test where it now fails to convert a type. It seems we are exactly hitting the case where no converter is specified. The test continues to work if I apply this patch:
```
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -1325,11 +1325,11 @@ Block *ConversionPatternRewriterImpl::ap
Value argMat = buildUnresolvedMaterialization(
MaterializationKind::Argument, newBlock, newBlock->begin(),
origArg.getLoc(), /*inputs=*/replArgs, origArgType, converter);
- mapping.map(origArg, argMat);
- appendRewrite<ReplaceBlockArgRewrite>(block, origArg);
Type legalOutputType;
if (converter) {
+ mapping.map(origArg, argMat);
+ appendRewrite<ReplaceBlockArgRewrite>(block, origArg);
legalOutputType = converter->convertType(origArgType);
} else if (replArgs.size() == 1) {
// When there is no type converter, assume that the new block argument
@@ -1340,6 +1340,8 @@ Block *ConversionPatternRewriterImpl::ap
// case, we currently use the original block argument type (produced by
// the argument materialization).
legalOutputType = replArgs[0].getType();
+ mapping.map(origArg, replArgs[0]);
+ appendRewrite<ReplaceBlockArgRewrite>(block, origArg);
}
if (legalOutputType && legalOutputType != origArgType) {
Value targetMat = buildUnresolvedTargetMaterialization(
```
Does this patch look reasonable? I tried to look at the earlier code that you tried to restore here, and it seems the mapping stuff is still missing, so I tried adding it back.
https://github.com/llvm/llvm-project/pull/101148
More information about the Mlir-commits
mailing list