[Mlir-commits] [mlir] [mlir] Speed up resolving ExtractValueOp source (PR #176478)

Matthias Springer llvmlistbot at llvm.org
Sun Jan 18 23:47:32 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> {
----------------
matthias-springer wrote:

Can you add a (simplified) before + after IR snippet here? (And mention what `posToExtractOps` would look like in that example.)

https://github.com/llvm/llvm-project/pull/176478


More information about the Mlir-commits mailing list