[Mlir-commits] [mlir] [mlir][Transforms] Dialect conversion: Remove workaround (PR #96186)

Matthias Springer llvmlistbot at llvm.org
Thu Jun 20 05:53:50 PDT 2024


https://github.com/matthias-springer created https://github.com/llvm/llvm-project/pull/96186

This commit removes a `FIXME` in the code base that was in place because of patterns that used the dialect conversion API incorrectly. Those patterns have been fixed and the workaround is no longer needed.

>From 949d9d8e6dde574754e03c241c5118fecaf8d8b5 Mon Sep 17 00:00:00 2001
From: Matthias Springer <mspringer at nvidia.com>
Date: Thu, 20 Jun 2024 14:48:22 +0200
Subject: [PATCH] [mlir][Transforms] Dialect conversion: Remove workaround

This commit removes a `FIXME` in the code base that was in place because of patterns that used the dialect conversion API incorrectly. Those patterns have been fixed and the workaround is no longer needed.
---
 .../lib/Transforms/Utils/DialectConversion.cpp | 18 ------------------
 1 file changed, 18 deletions(-)

diff --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp
index 1c0cb128aeabe..e6c0ee2ab2949 100644
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -734,11 +734,6 @@ class UnresolvedMaterializationRewrite : public OperationRewrite {
     return converterAndKind.getInt();
   }
 
-  /// Set the kind of this materialization.
-  void setMaterializationKind(MaterializationKind kind) {
-    converterAndKind.setInt(kind);
-  }
-
   /// Return the original illegal output type of the input values.
   Type getOrigOutputType() const { return origOutputType; }
 
@@ -2759,22 +2754,9 @@ static void computeNecessaryMaterializations(
       // TODO: Avoid materializing other types of conversions here.
     }
 
-    // Check to see if this is an argument materialization.
-    if (llvm::any_of(op->getOperands(), llvm::IsaPred<BlockArgument>) ||
-        llvm::any_of(inverseMapping[op->getResult(0)],
-                     llvm::IsaPred<BlockArgument>)) {
-      mat->setMaterializationKind(MaterializationKind::Argument);
-    }
-
     // If the materialization does not have any live users, we don't need to
     // generate a user materialization for it.
-    // FIXME: For argument materializations, we currently need to check if any
-    // of the inverse mapped values are used because some patterns expect blind
-    // value replacement even if the types differ in some cases. When those
-    // patterns are fixed, we can drop the argument special case here.
     bool isMaterializationLive = isLive(opResult);
-    if (mat->getMaterializationKind() == MaterializationKind::Argument)
-      isMaterializationLive |= llvm::any_of(inverseMapping[opResult], isLive);
     if (!isMaterializationLive)
       continue;
     if (!necessaryMaterializations.insert(mat))



More information about the Mlir-commits mailing list