[Mlir-commits] [mlir] [mlir][tosa] Fold reshape of dense resource constants (PR #213225)

Thibaut Goetghebuer-Planchon llvmlistbot at llvm.org
Tue Aug 4 03:09:17 PDT 2026


================
@@ -2117,6 +2117,16 @@ OpFoldResult ReshapeOp::fold(FoldAdaptor adaptor) {
   if (!inputTy.getElementType().isIntOrIndexOrFloat())
     return {};
 
+  // Reshaping a resource-backed constant only requires updating its type.
+  if (auto operand = llvm::dyn_cast_if_present<DenseResourceElementsAttr>(
+          adaptor.getInput1())) {
+    if (!outputTy.hasStaticShape()) {
----------------
Tessil wrote:

Done

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


More information about the Mlir-commits mailing list