[Mlir-commits] [mlir] [mlir] Always update ExtractValue to use last container in insert chain (PR #176588)

Tobias Gysi llvmlistbot at llvm.org
Sun Jan 18 22:10:10 PST 2026


================
@@ -1928,11 +1928,20 @@ OpFoldResult LLVM::ExtractValueOp::fold(FoldAdaptor adaptor) {
     return getResult();
   }
 
-  Operation *container = getContainer().getDefiningOp();
-  OpFoldResult result = {};
+  Attribute containerAttr;
+  if (matchPattern(getContainer(), m_Constant(&containerAttr))) {
----------------
gysit wrote:

The extract value position change does not benefit from the walking the insert value op chain though. I would argue that doing it after the insert value op walk allows us to fold in one go which seems beneficial (e.g. if you call createOrFold this will only be called once)? 

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


More information about the Mlir-commits mailing list