Skip to content

Commit 1102603

Browse files
[mlir][Transforms] Fix mapping in findOrBuildReplacementValue
Fixes two minor issues in `findOrBuildReplacementValue`: * Remove a redundant `mapping.map`. * Map `repl` instead of `value`. We used to overwrite an existing mapping, which may 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`.
1 parent faa30be commit 1102603

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

mlir/lib/Transforms/Utils/DialectConversion.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,11 +1533,10 @@ Value ConversionPatternRewriterImpl::findOrBuildReplacementValue(
15331533
Value castValue =
15341534
buildUnresolvedMaterialization(MaterializationKind::Source,
15351535
computeInsertPoint(repl), value.getLoc(),
1536-
/*valuesToMap=*/{value}, /*inputs=*/repl,
1536+
/*valuesToMap=*/repl, /*inputs=*/repl,
15371537
/*outputType=*/value.getType(),
15381538
/*originalType=*/Type(), converter)
15391539
.front();
1540-
mapping.map(value, castValue);
15411540
return castValue;
15421541
}
15431542

0 commit comments

Comments
 (0)