2020-05-30 08:49:25 +08:00
|
|
|
// RUN: npcomp-opt -lower-ranked-shapes <%s -split-input-file -verify-diagnostics | FileCheck %s --dump-input=fail
|
2020-05-12 12:22:40 +08:00
|
|
|
|
|
|
|
|
|
|
|
// CHECK-LABEL: func @broadcast_rank2_rank1
|
2020-05-16 07:33:01 +08:00
|
|
|
func @broadcast_rank2_rank1(%arg0: index, %arg1: index, %arg2: index) -> (index, index) {
|
2020-05-12 12:22:40 +08:00
|
|
|
// CHECK-NOT: shape.broadcast
|
|
|
|
// CHECK-NOT: tcp.get_extent
|
2020-05-30 08:49:25 +08:00
|
|
|
// CHECK-NOT: shape.from_extents
|
2020-05-22 05:51:01 +08:00
|
|
|
%0 = shape.from_extents %arg0, %arg1
|
|
|
|
%1 = shape.from_extents %arg2
|
2020-05-12 12:22:40 +08:00
|
|
|
%2 = "shape.broadcast"(%0, %1) : (!shape.shape, !shape.shape) -> !shape.shape
|
|
|
|
%e0 = tcp.get_extent %2, 0
|
|
|
|
%e1 = tcp.get_extent %2, 1
|
|
|
|
return %e0, %e1 : index, index
|
|
|
|
}
|
2020-05-19 04:35:25 +08:00
|
|
|
|
|
|
|
// CHECK-LABEL: func @erase_shape_observe_error
|
|
|
|
func @erase_shape_observe_error(%arg0: index) {
|
2020-05-30 08:49:25 +08:00
|
|
|
// CHECK-NOT: tcp.shape_observe_error
|
|
|
|
// CHECK-NOT: shape.from_extents
|
2020-05-22 05:51:01 +08:00
|
|
|
%0 = shape.from_extents %arg0
|
2020-05-19 04:35:25 +08:00
|
|
|
"tcp.shape_observe_error"(%0) : (!shape.shape) -> none
|
|
|
|
return
|
|
|
|
}
|
2020-05-30 08:49:25 +08:00
|
|
|
|
|
|
|
// -----
|
|
|
|
|
|
|
|
func @cannot_erase_shape_from_extents() -> !shape.shape {
|
|
|
|
// expected-error @+1 {{could not be eliminated}}
|
|
|
|
%0 = shape.from_extents
|
|
|
|
return %0 : !shape.shape
|
|
|
|
}
|