summaryrefslogtreecommitdiffstats
path: root/mlir/test/Transforms
diff options
context:
space:
mode:
authorStephan Herhut <herhut@google.com>2019-11-15 05:27:57 -0800
committerA. Unique TensorFlower <gardener@tensorflow.org>2019-11-15 05:28:31 -0800
commit57bafc674e68396374c62f4ecb8cb43064d41b27 (patch)
treedd997edd6ab03b3543b38ef63e8219d25558c9fa /mlir/test/Transforms
parent9c7bceb4fe5144fbe1ef4f1cdda3c802fb272248 (diff)
downloadbcm5719-llvm-57bafc674e68396374c62f4ecb8cb43064d41b27.tar.gz
bcm5719-llvm-57bafc674e68396374c62f4ecb8cb43064d41b27.zip
Mark std.view as no-sideeffect.
The same reasoning as for std.subview applies. PiperOrigin-RevId: 280639308
Diffstat (limited to 'mlir/test/Transforms')
-rw-r--r--mlir/test/Transforms/canonicalize.mlir6
1 files changed, 6 insertions, 0 deletions
diff --git a/mlir/test/Transforms/canonicalize.mlir b/mlir/test/Transforms/canonicalize.mlir
index edef97456a0..f53d8292406 100644
--- a/mlir/test/Transforms/canonicalize.mlir
+++ b/mlir/test/Transforms/canonicalize.mlir
@@ -640,6 +640,7 @@ func @cast_values(%arg0: tensor<*xi32>, %arg1: memref<?xi32>) -> (tensor<2xi32>,
// CHECK-LABEL: func @view
func @view(%arg0 : index) {
%0 = alloc() : memref<2048xi8>
+ %c0 = constant 0 : index
%c7 = constant 7 : index
%c11 = constant 11 : index
%c15 = constant 15 : index
@@ -648,30 +649,35 @@ func @view(%arg0 : index) {
// CHECK: std.view %0[][] : memref<2048xi8> to memref<7x11xf32, #[[VIEW_MAP0]]>
%1 = view %0[%c15][%c7, %c11]
: memref<2048xi8> to memref<?x?xf32, #TEST_VIEW_MAP0>
+ load %1[%c0, %c0] : memref<?x?xf32, #TEST_VIEW_MAP0>
// Test: fold constant sizes but not offset, update map with static stride.
// Test that we do not a fold dynamic dim which is not produced by a constant.
// CHECK: std.view %0[%arg0][] : memref<2048xi8> to memref<7x11xf32, #[[VIEW_MAP1]]>
%2 = view %0[%arg0][%c7, %c11]
: memref<2048xi8> to memref<?x?xf32, #TEST_VIEW_MAP0>
+ load %2[%c0, %c0] : memref<?x?xf32, #TEST_VIEW_MAP0>
// Test: fold constant offset but not sizes, update map with constant offset.
// Test that we fold constant offset but not dynamic dims.
// CHECK: std.view %0[][%arg0, %arg0] : memref<2048xi8> to memref<?x?xf32, #[[VIEW_MAP2]]>
%3 = view %0[%c15][%arg0, %arg0]
: memref<2048xi8> to memref<?x?xf32, #TEST_VIEW_MAP0>
+ load %3[%c0, %c0] : memref<?x?xf32, #TEST_VIEW_MAP0>
// Test: fold one constant dim, no offset, should update with constant
// stride on dim 1, but leave dynamic stride on dim 0.
// CHECK: std.view %0[][%arg0, %arg0] : memref<2048xi8> to memref<?x?x7xf32, #[[VIEW_MAP3]]>
%4 = view %0[][%arg0, %arg0, %c7]
: memref<2048xi8> to memref<?x?x?xf32, #TEST_VIEW_MAP1>
+ load %4[%c0, %c0, %c0] : memref<?x?x?xf32, #TEST_VIEW_MAP1>
// Test: preserve an existing static dim size while folding a dynamic
// dimension and offset.
// CHECK: std.view %0[][] : memref<2048xi8> to memref<7x4xf32, #[[VIEW_MAP4]]>
%5 = view %0[%c15][%c7]
: memref<2048xi8> to memref<?x4xf32, #TEST_VIEW_MAP2>
+ load %5[%c0, %c0] : memref<?x4xf32, #TEST_VIEW_MAP2>
return
}
OpenPOWER on IntegriCloud