Skip to content

Commit a4e4527

Browse files
[mlir][Transforms] Fix replaceUsesOfBlockArgument API (#144706)
Before this PR, users had to pass the "old" block argument when replacing the uses of a block argument in a newly converted block. Users can now pass the actual block argument that should be replaced. Note for LLVM integration: Make sure to pass the current block argument instead of the old one.
1 parent 278ece7 commit a4e4527

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ static void restoreByValRefArgumentType(
295295
cast<TypeAttr>(byValRefAttr->getValue()).getValue());
296296

297297
auto valueArg = rewriter.create<LLVM::LoadOp>(arg.getLoc(), resTy, arg);
298-
rewriter.replaceUsesOfBlockArgument(oldArg, valueArg);
298+
rewriter.replaceUsesOfBlockArgument(arg, valueArg);
299299
}
300300
}
301301

mlir/lib/Transforms/Utils/DialectConversion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1743,7 +1743,7 @@ void ConversionPatternRewriter::replaceUsesOfBlockArgument(BlockArgument from,
17431743
});
17441744
impl->appendRewrite<ReplaceBlockArgRewrite>(from.getOwner(), from,
17451745
impl->currentTypeConverter);
1746-
impl->mapping.map(impl->mapping.lookupOrDefault(from), to);
1746+
impl->mapping.map(from, to);
17471747
}
17481748

17491749
Value ConversionPatternRewriter::getRemappedValue(Value key) {

0 commit comments

Comments
 (0)