[Mlir-commits] [mlir] [MLIR] Extend the extractvalue fold method (PR #172297)

Vadim Curcă llvmlistbot at llvm.org
Mon Dec 15 07:34:01 PST 2025


================
@@ -1975,9 +1981,32 @@ OpFoldResult LLVM::ExtractValueOp::fold(FoldAdaptor adaptor) {
       getContainerMutable().assign(insertValueOp.getContainer());
       result = getResult();
     }
-    insertValueOp = insertValueOp.getContainer().getDefiningOp<InsertValueOp>();
+    container = insertValueOp.getContainer().getDefiningOp();
+  }
+  if (!container)
+    return result;
+
+  Attribute containerAttr;
+  if (!matchPattern(container, m_Constant(&containerAttr)))
----------------
VadimCurca wrote:

I might be misunderstanding your comment, but note that `container` here is not strictly the initial constant. It is the container at the end of the `insertValueOp` chain (if such a chain exists). If there isn't a chain, then container corresponds to the initial constant.

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


More information about the Mlir-commits mailing list