[Mlir-commits] [mlir] [MLIR][Transforms] Fix dialect conversion inverse mapping (PR #104648)

Billy Zhu llvmlistbot at llvm.org
Fri Aug 16 16:11:01 PDT 2024


https://github.com/zyx-billy created https://github.com/llvm/llvm-project/pull/104648

Inverse mapping needs to be updated for the result that was remapped (it was previously only updated halfway).

>From 15c0f2c4aef81837d7559fcca73b83e8093a8f0f Mon Sep 17 00:00:00 2001
From: Billy Zhu <billyzhu at modular.com>
Date: Fri, 16 Aug 2024 16:09:50 -0700
Subject: [PATCH] update inverse mapping

---
 mlir/lib/Transforms/Utils/DialectConversion.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp
index 11e593cebc09b3..e71b91c4e54cdf 100644
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -2527,6 +2527,7 @@ LogicalResult OperationConverter::legalizeConvertedOpResultTypes(
           opReplacement->getConverter());
       rewriterImpl.mapping.map(result, castValue);
       inverseMapping[castValue].push_back(result);
+      llvm::erase(inverseMapping[newValue], result);
     }
   }
 



More information about the Mlir-commits mailing list