[Mlir-commits] [mlir] 544cebd - Change type constraint of the "index" in "shape.split_at" to Shape_SizeOrIndexType
Jacques Pienaar
llvmlistbot at llvm.org
Wed Feb 10 11:58:35 PST 2021
Author: Jing Pu
Date: 2021-02-10T11:58:19-08:00
New Revision: 544cebd6197820e35047eba0d0e04b9008bdb860
URL: https://github.com/llvm/llvm-project/commit/544cebd6197820e35047eba0d0e04b9008bdb860
DIFF: https://github.com/llvm/llvm-project/commit/544cebd6197820e35047eba0d0e04b9008bdb860.diff
LOG: Change type constraint of the "index" in "shape.split_at" to Shape_SizeOrIndexType
Make the type contraint consistent with other shape dialect operations.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D96377
Added:
Modified:
mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
mlir/test/Dialect/Shape/canonicalize.mlir
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td b/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
index 271a4f87eec9..f917f2e78da9 100644
--- a/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
+++ b/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
@@ -558,7 +558,8 @@ def Shape_SplitAtOp : Shape_Op<"split_at", [NoSideEffect]> {
- `index` is in the range [-rank(operand),rank(operand)]
}];
- let arguments = (ins Shape_ShapeOrExtentTensorType:$operand, I32:$index);
+ let arguments = (ins Shape_ShapeOrExtentTensorType:$operand,
+ Shape_SizeOrIndexType:$index);
let results = (outs Shape_ShapeType:$head, Shape_ShapeType:$tail);
let hasFolder = 1;
}
diff --git a/mlir/test/Dialect/Shape/canonicalize.mlir b/mlir/test/Dialect/Shape/canonicalize.mlir
index 3703075f11d9..f7e3c66a6014 100644
--- a/mlir/test/Dialect/Shape/canonicalize.mlir
+++ b/mlir/test/Dialect/Shape/canonicalize.mlir
@@ -14,9 +14,9 @@ func @f(%arg0: tensor<2x3x4xf32>) -> tensor<?xindex> {
func @f() -> (!shape.shape, !shape.shape) {
// CHECK: shape.const_shape [2, 3] : !shape.shape
// CHECK: shape.const_shape [4, 5] : !shape.shape
- %c2 = constant 2 : i32
+ %c2 = constant 2 : index
%0 = shape.const_shape [2, 3, 4, 5] : !shape.shape
- %head, %tail = "shape.split_at"(%0, %c2) : (!shape.shape, i32) -> (!shape.shape, !shape.shape)
+ %head, %tail = "shape.split_at"(%0, %c2) : (!shape.shape, index) -> (!shape.shape, !shape.shape)
return %head, %tail : !shape.shape, !shape.shape
}
@@ -28,9 +28,9 @@ func @f() -> (!shape.shape, !shape.shape) {
func @f() -> (!shape.shape, !shape.shape) {
// CHECK: shape.const_shape [2, 3, 4] : !shape.shape
// CHECK: shape.const_shape [5] : !shape.shape
- %c-1 = constant -1 : i32
+ %c-1 = constant -1 : index
%0 = shape.const_shape [2, 3, 4, 5] : !shape.shape
- %head, %tail = "shape.split_at"(%0, %c-1) : (!shape.shape, i32) -> (!shape.shape, !shape.shape)
+ %head, %tail = "shape.split_at"(%0, %c-1) : (!shape.shape, index) -> (!shape.shape, !shape.shape)
return %head, %tail : !shape.shape, !shape.shape
}
@@ -40,9 +40,9 @@ func @f() -> (!shape.shape, !shape.shape) {
// CHECK-LABEL: func @f
func @f() -> (!shape.shape, !shape.shape) {
// CHECK: shape.split_at
- %c5 = constant 5 : i32
+ %c5 = constant 5 : index
%0 = shape.const_shape [2, 3, 4, 5] : !shape.shape
- %head, %tail = "shape.split_at"(%0, %c5) : (!shape.shape, i32) -> (!shape.shape, !shape.shape)
+ %head, %tail = "shape.split_at"(%0, %c5) : (!shape.shape, index) -> (!shape.shape, !shape.shape)
return %head, %tail : !shape.shape, !shape.shape
}
More information about the Mlir-commits
mailing list