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

Udaya Ranga llvmlistbot at llvm.org
Fri Jul 31 07:32:38 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()) {
----------------
udaya-ranga wrote:

Can be hoisted above line 2121

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


More information about the Mlir-commits mailing list