[Mlir-commits] [mlir] [mlir][tosa] Fix not to crash with large permutation indexes (PR #69857)

Jacques Pienaar llvmlistbot at llvm.org
Fri Oct 27 09:34:11 PDT 2023


================
@@ -966,6 +966,18 @@ LogicalResult tosa::TransposeOp::inferReturnTypeComponents(
   if (matchPattern(adaptor.getPerms(), m_Constant(&attr)) &&
       attr.getType().getRank() == 1) {
     ShapeAdaptor permShape = attr;
+    // Constant permutation must be the same length as the input rank.
+    if (inputShape.getRank() != permShape.getRank())
+      return emitOptionalError(location,
+                               "Constant permutation must be the same length"
----------------
jpienaar wrote:

Convention for errors via emitError etc is sentence fragments (start lower cased and no trailing punctuation)

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


More information about the Mlir-commits mailing list