33// CHECK-LABEL: @dim_const
44// CHECK: %[[ret:.+]] = arith.constant 3 : index
55// CHECK: return %[[ret]]
6- func.func @dim_const (%m : tensor <3 x5 xi32 >) -> index {
6+ func.func @dim_const (%t : tensor <3 x5 xi32 >) -> index {
77 %c0 = arith.constant 0 : index
8- %0 = tensor.dim %m , %c0 : tensor <3 x5 xi32 >
8+ %0 = tensor.dim %t , %c0 : tensor <3 x5 xi32 >
99 return %0 : index
1010}
1111
@@ -15,8 +15,8 @@ func.func @dim_const(%m: tensor<3x5xi32>) -> index {
1515// CHECK: %[[op:.+]] = tensor.dim
1616// CHECK: %[[ret:.+]] = test.reflect_bounds {smax = 5 : index, smin = 3 : index, umax = 5 : index, umin = 3 : index} %[[op]]
1717// CHECK: return %[[ret]]
18- func.func @dim_any_static (%m : tensor <3 x5 xi32 >, %x: index ) -> index {
19- %0 = tensor.dim %m , %x : tensor <3 x5 xi32 >
18+ func.func @dim_any_static (%t : tensor <3 x5 xi32 >, %x: index ) -> index {
19+ %0 = tensor.dim %t , %x : tensor <3 x5 xi32 >
2020 %1 = test.reflect_bounds %0 : index
2121 return %1 : index
2222}
@@ -27,9 +27,9 @@ func.func @dim_any_static(%m: tensor<3x5xi32>, %x: index) -> index {
2727// CHECK: %[[op:.+]] = tensor.dim
2828// CHECK: %[[ret:.+]] = test.reflect_bounds {smax = 9223372036854775807 : index, smin = 0 : index, umax = 9223372036854775807 : index, umin = 0 : index} %[[op]]
2929// CHECK: return %[[ret]]
30- func.func @dim_dynamic (%m : tensor <?x5 xi32 >) -> index {
30+ func.func @dim_dynamic (%t : tensor <?x5 xi32 >) -> index {
3131 %c0 = arith.constant 0 : index
32- %0 = tensor.dim %m , %c0 : tensor <?x5 xi32 >
32+ %0 = tensor.dim %t , %c0 : tensor <?x5 xi32 >
3333 %1 = test.reflect_bounds %0 : index
3434 return %1 : index
3535}
@@ -40,8 +40,8 @@ func.func @dim_dynamic(%m: tensor<?x5xi32>) -> index {
4040// CHECK: %[[op:.+]] = tensor.dim
4141// CHECK: %[[ret:.+]] = test.reflect_bounds {smax = 9223372036854775807 : index, smin = 0 : index, umax = 9223372036854775807 : index, umin = 0 : index} %[[op]]
4242// CHECK: return %[[ret]]
43- func.func @dim_any_dynamic (%m : tensor <?x5 xi32 >, %x: index ) -> index {
44- %0 = tensor.dim %m , %x : tensor <?x5 xi32 >
43+ func.func @dim_any_dynamic (%t : tensor <?x5 xi32 >, %x: index ) -> index {
44+ %0 = tensor.dim %t , %x : tensor <?x5 xi32 >
4545 %1 = test.reflect_bounds %0 : index
4646 return %1 : index
4747}
@@ -52,10 +52,23 @@ func.func @dim_any_dynamic(%m: tensor<?x5xi32>, %x: index) -> index {
5252// CHECK: %[[op:.+]] = tensor.dim
5353// CHECK: %[[ret:.+]] = test.reflect_bounds {smax = 5 : index, smin = 3 : index, umax = 5 : index, umin = 3 : index} %[[op]]
5454// CHECK: return %[[ret]]
55- func.func @dim_some_omitting_dynamic (%m : tensor <?x3 x5 xi32 >, %x: index ) -> index {
55+ func.func @dim_some_omitting_dynamic (%t : tensor <?x3 x5 xi32 >, %x: index ) -> index {
5656 %c1 = arith.constant 1 : index
5757 %0 = arith.maxsi %x , %c1 : index
58- %1 = tensor.dim %m , %0 : tensor <?x3 x5 xi32 >
58+ %1 = tensor.dim %t , %0 : tensor <?x3 x5 xi32 >
5959 %2 = test.reflect_bounds %1 : index
6060 return %2 : index
6161}
62+
63+ // -----
64+
65+ // CHECK-LABEL: @dim_unranked
66+ // CHECK: %[[op:.+]] = tensor.dim
67+ // CHECK: %[[ret:.+]] = test.reflect_bounds {smax = 9223372036854775807 : index, smin = 0 : index, umax = 9223372036854775807 : index, umin = 0 : index} %[[op]]
68+ // CHECK: return %[[ret]]
69+ func.func @dim_unranked (%t: tensor <*xi32 >) -> index {
70+ %c0 = arith.constant 0 : index
71+ %0 = tensor.dim %t , %c0 : tensor <*xi32 >
72+ %1 = test.reflect_bounds %0 : index
73+ return %1 : index
74+ }
0 commit comments