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

Mehdi Amini llvmlistbot at llvm.org
Mon Dec 15 07:26:51 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)))
----------------
joker-eph wrote:

I'm not following the logic very well: seems to me that we're at the end of a chain of `insertValueOp`s and you're then just looking at the initial constant. However the initial value can have been overridden by one of the insert, can't it?

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


More information about the Mlir-commits mailing list