[Mlir-commits] [mlir] [mlir][tosa] Check for 0-ranked-tensors during fold (PR #68512)

Georgios Pinitas llvmlistbot at llvm.org
Tue Oct 10 04:03:09 PDT 2023


================
@@ -874,7 +874,8 @@ OpFoldResult ReverseOp::fold(FoldAdaptor adaptor) {
     return operandAttr;
 
   // If the dim-length is 1, tosa.reverse is a no-op.
-  if (operandTy.hasRank() && operandTy.getDimSize(axis) == 1)
+  if (operandTy.hasRank() && operandTy.getRank() != 0 &&
----------------
GeorgeARM wrote:

Give it a go. Would be great to write a small canonicalization test as well in `canonicalize.mlir` in TOSA tests for these. 

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


More information about the Mlir-commits mailing list