fix: create new op in generic type conversion

converting types of the original op seems to have an impact on other
operations using the result type, which should consider checking the
different cases (whether the type has been converted yet, or not).
However, creating a new op don't have this issue
This commit is contained in:
youben11
2022-10-13 09:58:57 +01:00
committed by Ayoub Benaissa
parent ef778ac75b
commit 48dee4a71b

View File

@@ -54,11 +54,12 @@ struct GenericTypeConverterPattern : public mlir::OpRewritePattern<Op> {
mlir::LogicalResult
matchAndRewrite(Op op, mlir::PatternRewriter &rewriter) const override {
convertOperandAndResultTypes(rewriter, op,
auto newOp = rewriter.clone(*op);
convertOperandAndResultTypes(rewriter, newOp,
[&](mlir::MLIRContext *, mlir::Type t) {
return converter.convertType(t);
});
rewriter.replaceOp(op, newOp->getResults());
return mlir::success();
}