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

Sarthak Gupta llvmlistbot at llvm.org
Tue Oct 10 03:58:46 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 &&
----------------
gptsarthak wrote:

I'm new to MLIR and I'm not sure if they should or shoudnt get folded.
If they should, we can change it to `if (operandTy.hasRank() && (operandTy.getRank() != 0 || operandTy.getDimSize(axis) == 1))`. Would you like me to make that change?

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


More information about the Mlir-commits mailing list