Integrate llvm-project at e9c9ee9fe694067ee96643d05d6ac378349386bb (#8585)

* Integrate llvm-project at e9c9ee9fe694067ee96643d05d6ac378349386bb

* Reset third_party/llvm-project: e9c9ee9fe694067ee96643d05d6ac378349386bb (2022-03-15 21:51:12 +0000): [libc][NFC] Fix typos and reduntent code triggering compiler warinings.

* Move MHLO and TF to matching commits

TF: 05f17fca35623f4ab6d275ed95f0e1363c939f73
MHLO: 57288f12595a2ee0488806672a42da59b1e56e13
Piper CL: 435187843

* Fixes for bump LLVM @5e8700ce8bf58bdf0a59eef99c85185a74177555

* Remove uses of `verifier`.

* Fix verification methods after signature change of custom verify methods.

* Fixup fallout from bufferization changes

https://reviews.llvm.org/D121361
https://reviews.llvm.org/D121519

* Fix verifiers of Flow and VM ops.

* Fix lit test.

* Update iree-dialects in integrations.

Co-authored-by: Nicolas Vasilache <ntv@google.com>
Co-authored-by: Stella Laurenzo <stellaraccident@gmail.com>
diff --git a/integrations/tensorflow/iree-dialects/test/iree_linalgext/invalid.mlir b/integrations/tensorflow/iree-dialects/test/iree_linalgext/invalid.mlir
index bb6b37d..517e9c2 100644
--- a/integrations/tensorflow/iree-dialects/test/iree_linalgext/invalid.mlir
+++ b/integrations/tensorflow/iree-dialects/test/iree_linalgext/invalid.mlir
@@ -105,18 +105,18 @@
 
 // -----
 
-func @scatter_mixed_tensor_memref(
+func @scatter_output_type_mismatch(
     %update : tensor<?x?xf32>, %indices : tensor<?x1xi32>,
-    %original : tensor<?x?xf32>) -> memref<?x?xf32> {
-  // expected-error @+1 {{expected type of `outs` operand #0 'tensor<?x?xf32>' to be same as result type 'memref<?x?xf32>'}}
+    %original : tensor<?x?xf32>) -> tensor<4x?xf32> {
+  // expected-error @+1 {{expected type of `outs` operand #0 'tensor<?x?xf32>' to be same as result type 'tensor<4x?xf32>'}}
   %0 = iree_linalg_ext.scatter unique_indices(true)
       ins(%update, %indices : tensor<?x?xf32>, tensor<?x1xi32>)
       outs(%original : tensor<?x?xf32>) {
       ^bb0(%arg1: f32, %arg2: f32):
         %1 = arith.addf %arg1, %arg2 : f32
         iree_linalg_ext.yield %1 : f32
-      } -> memref<?x?xf32>
-  return %0 : memref<?x?xf32>
+      } -> tensor<4x?xf32>
+  return %0 : tensor<4x?xf32>
 }
 
 // -----
@@ -403,3 +403,46 @@
          outs(%init : tensor<3x5xi32>) : tensor<3x5xi32>
   return %0 : tensor<3x5xi32>
 }
+
+// -----
+
+func @not_enough_results() -> () {
+  %num_threads = arith.constant 100 : index
+  // expected-error@+1 {{'iree_linalg_ext.in_parallel' op produces 1 results, but its terminator yields 0 values}}
+  %result = iree_linalg_ext.in_parallel %num_threads -> tensor<100xf32> {
+    ^bb0(%thread_idx : index):
+      iree_linalg_ext.perform_concurrently {}
+  }
+}
+
+// -----
+
+func @too_many_results(%1 : tensor<1xf32>, %out : tensor<100xf32>) -> () {
+  %num_threads = arith.constant 100 : index
+  // expected-error@+1 {{'iree_linalg_ext.in_parallel' op produces 1 results, but its terminator yields 2 values}}
+  %result = iree_linalg_ext.in_parallel %num_threads -> tensor<100xf32> {
+    ^bb0(%thread_idx : index):
+      %0 = arith.constant 1 : index
+      iree_linalg_ext.perform_concurrently {
+        iree_linalg_ext.parallel_insert_slice %1 into %out[%thread_idx][%0][%0] :
+          tensor<1xf32> into tensor<100xf32>
+        iree_linalg_ext.parallel_insert_slice %1 into %out[%thread_idx][%0][%0] :
+          tensor<1xf32> into tensor<100xf32>
+      }
+  }
+}
+
+// -----
+
+func @type_mismatch(%1 : tensor<1xf32>, %out : tensor<200xf32>) -> () {
+  %num_threads = arith.constant 100 : index
+  // expected-error@+1 {{'iree_linalg_ext.in_parallel' op type mismatch between 0th result of in_parallel ('tensor<200xf32>') and 0th result yielded by its terminator ('tensor<100xf32>')}}
+  %result = iree_linalg_ext.in_parallel %num_threads -> tensor<100xf32> {
+    ^bb0(%thread_idx : index):
+      %0 = arith.constant 1 : index
+      iree_linalg_ext.perform_concurrently {
+        iree_linalg_ext.parallel_insert_slice %1 into %out[%thread_idx][%0][%0] :
+          tensor<1xf32> into tensor<200xf32>
+      }
+  }
+}