[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.
This commit is contained in:
Matthias Springer
2025-06-19 15:39:06 +02:00
committed by GitHub
parent 278ece7c80
commit a4e4527c4b
2 changed files with 2 additions and 2 deletions

View File

@@ -295,7 +295,7 @@ static void restoreByValRefArgumentType(
cast<TypeAttr>(byValRefAttr->getValue()).getValue());
auto valueArg = rewriter.create<LLVM::LoadOp>(arg.getLoc(), resTy, arg);
rewriter.replaceUsesOfBlockArgument(oldArg, valueArg);
rewriter.replaceUsesOfBlockArgument(arg, valueArg);
}
}

View File

@@ -1743,7 +1743,7 @@ void ConversionPatternRewriter::replaceUsesOfBlockArgument(BlockArgument from,
});
impl->appendRewrite<ReplaceBlockArgRewrite>(from.getOwner(), from,
impl->currentTypeConverter);
impl->mapping.map(impl->mapping.lookupOrDefault(from), to);
impl->mapping.map(from, to);
}
Value ConversionPatternRewriter::getRemappedValue(Value key) {