[Mlir-commits] [mlir] [mlir] Speed up resolving ExtractValueOp source (PR #176478)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Jan 19 08:23:29 PST 2026
================
@@ -2027,6 +2027,81 @@ void ExtractValueOp::build(OpBuilder &builder, OperationState &state,
// InsertValueOp
//===----------------------------------------------------------------------===//
+namespace {
+/// Update any ExtractValueOps using a given InsertValueOp to instead read from
+/// the closest InsertValueOp in the chain leading up to the current op that
+/// writes to the same member. This traversal could be done entirely in
+/// ExtractValueOp::fold, but doing it here significantly speeds things up
+/// because we can handle several ExtractValueOps with a single traversal.
+struct ResolveExtractValueSource : public OpRewritePattern<InsertValueOp> {
----------------
neildhar wrote:
I added the example from the PR description, with both the transformation that will be applied, and why the pattern is faster. If it looks good, I'd appreciate if you could merge the PR, as I don't have commit access.
https://github.com/llvm/llvm-project/pull/176478
More information about the Mlir-commits
mailing list