[Mlir-commits] [mlir] [mlir][Transforms] Fix build after #116524 (PR #121578)

Matthias Springer llvmlistbot at llvm.org
Fri Jan 3 07:25:32 PST 2025


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

Fix build errors after #116524.

```
error: call of overloaded ‘TypeRange(ValueVector&)’ is ambiguous
```

>From 9970623757ccc12b07ff437abd595aaea88fdf11 Mon Sep 17 00:00:00 2001
From: Matthias Springer <mspringer at nvidia.com>
Date: Fri, 3 Jan 2025 16:24:09 +0100
Subject: [PATCH] [mlir][Transforms] Fix build after #116524
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fix build errors after #116524.

```
error: call of overloaded ‘TypeRange(ValueVector&)’ is ambiguous
```
---
 mlir/lib/Transforms/Utils/DialectConversion.cpp | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp
index 0c5520988eff38..6c3863e4c7f666 100644
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -227,7 +227,7 @@ ConversionValueMapping::lookupOrDefault(Value from,
   ValueVector current{from};
   do {
     // Store the current value if the types match.
-    if (TypeRange(current) == desiredTypes)
+    if (TypeRange(ValueRange(current)) == desiredTypes)
       desiredValue = current;
 
     // If possible, Replace each value with (one or multiple) mapped values.
@@ -271,9 +271,8 @@ ConversionValueMapping::lookupOrDefault(Value from,
 ValueVector ConversionValueMapping::lookupOrNull(Value from,
                                                  TypeRange desiredTypes) const {
   ValueVector result = lookupOrDefault(from, desiredTypes);
-  TypeRange resultTypes(result);
   if (result == ValueVector{from} ||
-      (!desiredTypes.empty() && resultTypes != desiredTypes))
+      (!desiredTypes.empty() && TypeRange(ValueRange(result)) != desiredTypes))
     return {};
   return result;
 }
@@ -1291,7 +1290,7 @@ LogicalResult ConversionPatternRewriterImpl::remapValues(
     }
 
     ValueVector repl = mapping.lookupOrDefault(operand, legalTypes);
-    if (!repl.empty() && TypeRange(repl) == legalTypes) {
+    if (!repl.empty() && TypeRange(ValueRange(repl)) == legalTypes) {
       // Mapped values have the correct type or there is an existing
       // materialization. Or the operand is not mapped at all and has the
       // correct type.



More information about the Mlir-commits mailing list