[Mlir-commits] [mlir] [mlir][Transforms] Fix mapping in `findOrBuildReplacementValue` (PR #121644)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sat Jan 4 04:42:01 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-core
@llvm/pr-subscribers-mlir
Author: Matthias Springer (matthias-springer)
<details>
<summary>Changes</summary>
Fixes two minor issues in `findOrBuildReplacementValue`:
* Remove a redundant `mapping.map`.
* Map `repl` instead of `value`. We used to overwrite an existing mapping, which could introduce extra materializations.
Note: We generally do not want to overwrite mappings, but create a chain of mappings. There are still a few more places, where a mapping is overwritten. Once those are fixed, I will put an assertion into `ConversionValueMapping::map`.
---
Full diff: https://github.com/llvm/llvm-project/pull/121644.diff
1 Files Affected:
- (modified) mlir/lib/Transforms/Utils/DialectConversion.cpp (+1-2)
``````````diff
diff --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp
index 6c3863e4c7f666..4904d3ce3f8635 100644
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -1533,11 +1533,10 @@ Value ConversionPatternRewriterImpl::findOrBuildReplacementValue(
Value castValue =
buildUnresolvedMaterialization(MaterializationKind::Source,
computeInsertPoint(repl), value.getLoc(),
- /*valuesToMap=*/{value}, /*inputs=*/repl,
+ /*valuesToMap=*/repl, /*inputs=*/repl,
/*outputType=*/value.getType(),
/*originalType=*/Type(), converter)
.front();
- mapping.map(value, castValue);
return castValue;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/121644
More information about the Mlir-commits
mailing list