[Mlir-commits] [mlir] [mlir][tensor] Preserve encoding when folding empty (PR #176427)

Han-Chung Wang llvmlistbot at llvm.org
Fri Jan 16 11:13:46 PST 2026


================
@@ -40,11 +40,14 @@ struct FoldEmptyTensorWithReshapeOp : public OpRewritePattern<ReshapeOp> {
         !llvm::hasSingleElement(resultShapes))
       return failure();
 
+    Attribute encoding;
+    if (auto tensorTy = dyn_cast<RankedTensorType>(reshapeOp.getResultType())) {
+      encoding = tensorTy.getEncoding();
+    }
----------------
hanhanW wrote:

llvm style nit: drop braces.

https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements

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


More information about the Mlir-commits mailing list