Skip to content

Commit 5f7568a

Browse files
[mlir][Transforms] Fix mapping in findOrBuildReplacementValue (#121644)
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`.
1 parent a77346b commit 5f7568a

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
@@ -1489,11 +1489,10 @@ Value ConversionPatternRewriterImpl::findOrBuildReplacementValue(
14891489
Value castValue =
14901490
buildUnresolvedMaterialization(MaterializationKind::Source,
14911491
computeInsertPoint(repl), value.getLoc(),
1492-
/*valuesToMap=*/{value}, /*inputs=*/repl,
1492+
/*valuesToMap=*/repl, /*inputs=*/repl,
14931493
/*outputType=*/value.getType(),
14941494
/*originalType=*/Type(), converter)
14951495
.front();
1496-
mapping.map(value, castValue);
14971496
return castValue;
14981497
}
14991498

0 commit comments

Comments
 (0)