Integrate llvm-project at 523640f7a4c0 (#12419)

* Reset third_party/llvm-project:
523640f7a4c0b038ce630939af161fdfa964dba4 (2023-02-28 15:54:25 +0100):
[clang][Interp][NFC] Use qualified name in Function::getName()
* Note: upstream hoisting on tensors does not canonicalize `scf.for`
anymore, run canonicalization to make this test happy.

benchmarks: x86_64, cuda, comp-stats
diff --git a/compiler/src/iree/compiler/API2/api_exports.c b/compiler/src/iree/compiler/API2/api_exports.c
index c82f363..ce9464c 100644
--- a/compiler/src/iree/compiler/API2/api_exports.c
+++ b/compiler/src/iree/compiler/API2/api_exports.c
@@ -388,6 +388,7 @@
 extern void mlirOpPassManagerAddOwnedPass();
 extern void mlirOpPassManagerAddPipeline();
 extern void mlirOpPassManagerGetNestedUnder();
+extern void mlirOpPrintingFlagsAssumeVerified();
 extern void mlirOpPrintingFlagsCreate();
 extern void mlirOpPrintingFlagsDestroy();
 extern void mlirOpPrintingFlagsElideLargeElementsAttrs();
@@ -970,6 +971,7 @@
   x += (uintptr_t)&mlirOpPassManagerAddOwnedPass;
   x += (uintptr_t)&mlirOpPassManagerAddPipeline;
   x += (uintptr_t)&mlirOpPassManagerGetNestedUnder;
+  x += (uintptr_t)&mlirOpPrintingFlagsAssumeVerified;
   x += (uintptr_t)&mlirOpPrintingFlagsCreate;
   x += (uintptr_t)&mlirOpPrintingFlagsDestroy;
   x += (uintptr_t)&mlirOpPrintingFlagsElideLargeElementsAttrs;
diff --git a/compiler/src/iree/compiler/API2/api_exports.def b/compiler/src/iree/compiler/API2/api_exports.def
index 6e91e69..01dc1b1 100644
--- a/compiler/src/iree/compiler/API2/api_exports.def
+++ b/compiler/src/iree/compiler/API2/api_exports.def
@@ -380,6 +380,7 @@
   mlirOpPassManagerAddOwnedPass
   mlirOpPassManagerAddPipeline
   mlirOpPassManagerGetNestedUnder
+  mlirOpPrintingFlagsAssumeVerified
   mlirOpPrintingFlagsCreate
   mlirOpPrintingFlagsDestroy
   mlirOpPrintingFlagsElideLargeElementsAttrs
diff --git a/compiler/src/iree/compiler/API2/api_exports.ld b/compiler/src/iree/compiler/API2/api_exports.ld
index 55522d7..f21fcf7 100644
--- a/compiler/src/iree/compiler/API2/api_exports.ld
+++ b/compiler/src/iree/compiler/API2/api_exports.ld
@@ -381,6 +381,7 @@
     mlirOpPassManagerAddOwnedPass;
     mlirOpPassManagerAddPipeline;
     mlirOpPassManagerGetNestedUnder;
+    mlirOpPrintingFlagsAssumeVerified;
     mlirOpPrintingFlagsCreate;
     mlirOpPrintingFlagsDestroy;
     mlirOpPrintingFlagsElideLargeElementsAttrs;
diff --git a/compiler/src/iree/compiler/API2/api_exports.macos.lst b/compiler/src/iree/compiler/API2/api_exports.macos.lst
index 40d66a0..6628da9 100644
--- a/compiler/src/iree/compiler/API2/api_exports.macos.lst
+++ b/compiler/src/iree/compiler/API2/api_exports.macos.lst
@@ -379,6 +379,7 @@
 _mlirOpPassManagerAddOwnedPass
 _mlirOpPassManagerAddPipeline
 _mlirOpPassManagerGetNestedUnder
+_mlirOpPrintingFlagsAssumeVerified
 _mlirOpPrintingFlagsCreate
 _mlirOpPrintingFlagsDestroy
 _mlirOpPrintingFlagsElideLargeElementsAttrs
diff --git a/compiler/src/iree/compiler/Codegen/LLVMGPU/test/conv_pipeline_test.mlir b/compiler/src/iree/compiler/Codegen/LLVMGPU/test/conv_pipeline_test.mlir
index de0ea66..e450f97 100644
--- a/compiler/src/iree/compiler/Codegen/LLVMGPU/test/conv_pipeline_test.mlir
+++ b/compiler/src/iree/compiler/Codegen/LLVMGPU/test/conv_pipeline_test.mlir
@@ -1,4 +1,6 @@
-// RUN: iree-opt --split-input-file --pass-pipeline='builtin.module(hal.executable(hal.executable.variant(iree-llvmgpu-lower-executable-target)))' %s | FileCheck %s
+// RUN: iree-opt --split-input-file \
+// RUN:   --pass-pipeline='builtin.module(hal.executable(hal.executable.variant(iree-llvmgpu-lower-executable-target,canonicalize)))' \
+// RUN:   %s | FileCheck %s
 
 #device_target_cuda = #hal.device.target<"cuda", {executable_targets = [#hal.executable.target<"cuda", "cuda-nvptx-fb", {target_arch = "sm_35"}>]}>
 #executable_target_cuda_nvptx_fb = #hal.executable.target<"cuda", "cuda-nvptx-fb", {target_arch = "sm_35"}>
@@ -39,7 +41,7 @@
 // CHECK-COUNT-2:        vector.transfer_read
 // CHECK-COUNT-4:        vector.contract
 //         CHECK:      scf.yield %{{.*}} : vector<1x4x4xf32>
-//         CHECK:    scf.yield %{{.*}} : vector<1x4x4xf32>
+//         CHECK:    scf.yield %{{.*}} : vector<4x4xf32>
 //         CHECK:    vector.transfer_write {{.*}} : vector<4x4xf32>, memref<1x112x112x64xf32>
 
 // -----
diff --git a/compiler/src/iree/compiler/Codegen/SPIRV/test/tile_and_vectorize_batch_matmul.mlir b/compiler/src/iree/compiler/Codegen/SPIRV/test/tile_and_vectorize_batch_matmul.mlir
index e0911b3..505d196 100644
--- a/compiler/src/iree/compiler/Codegen/SPIRV/test/tile_and_vectorize_batch_matmul.mlir
+++ b/compiler/src/iree/compiler/Codegen/SPIRV/test/tile_and_vectorize_batch_matmul.mlir
@@ -1,4 +1,6 @@
-// RUN: iree-opt --split-input-file --pass-pipeline='builtin.module(hal.executable(hal.executable.variant(builtin.module(func.func(iree-spirv-tile,iree-spirv-vectorize, cse)))))' %s | FileCheck %s
+// RUN: iree-opt --split-input-file \
+// RUN:   --pass-pipeline='builtin.module(hal.executable(hal.executable.variant(builtin.module(func.func(iree-spirv-tile,canonicalize,cse,iree-spirv-vectorize,canonicalize,cse)))))' \
+// RUN:   %s | FileCheck %s
 
 #config = #iree_codegen.lowering_config<tile_sizes = [[1, 8, 64], [1, 8, 4], [0, 0, 0, 4]]>
 #translation = #iree_codegen.translation_info<SPIRVBaseVectorize>
diff --git a/compiler/src/iree/compiler/Codegen/SPIRV/test/tile_and_vectorize_conv.mlir b/compiler/src/iree/compiler/Codegen/SPIRV/test/tile_and_vectorize_conv.mlir
index 5b34d5b..24623dd 100644
--- a/compiler/src/iree/compiler/Codegen/SPIRV/test/tile_and_vectorize_conv.mlir
+++ b/compiler/src/iree/compiler/Codegen/SPIRV/test/tile_and_vectorize_conv.mlir
@@ -1,4 +1,6 @@
-// RUN: iree-opt --split-input-file --pass-pipeline='builtin.module(hal.executable(hal.executable.variant(builtin.module(func.func(iree-spirv-create-fast-slow-path,iree-spirv-tile,canonicalize,cse,iree-spirv-vectorize)))))' %s | FileCheck %s
+// RUN: iree-opt --split-input-file \
+// RUN:   --pass-pipeline='builtin.module(hal.executable(hal.executable.variant(builtin.module(func.func(iree-spirv-create-fast-slow-path,iree-spirv-tile,canonicalize,cse,iree-spirv-vectorize,canonicalize,cse)))))' \
+// RUN:   %s | FileCheck %s
 
 #config = #iree_codegen.lowering_config<tile_sizes = [[0, 4, 4, 16], [0, 2, 2, 4], [0, 0, 0, 0, 1, 1, 4], [0, 1, 0, 0]]>
 #translation = #iree_codegen.translation_info<SPIRVBaseVectorize>
@@ -468,11 +470,11 @@
 //      CHECK:   scf.for %{{.*}} = %c0 to %c3 step %c1
 // CHECK-SAME:       -> (tensor<2x8x1x4xf32>)
 //      CHECK:     scf.for %{{.*}} = %c0 to %c3 step %c1
-// CHECK-SAME:         -> (tensor<2x8x1x4xf32>)
+// CHECK-SAME:         -> (vector<4xf32>{{(, vector<4xf32>)+}})
 
 // CHECK-COUNT-64: vector.fma
 
 // For linalg.conv_2d_nchw_fchw
 // CHECK-COUNT-16: vector.transfer_write
 
-//  CHECK-COUNT-3: scf.yield %{{.+}} : tensor<2x8x1x4xf32>
+//  CHECK-COUNT-3: scf.yield %{{.+}} : tensor<2x16x8x8xf32>
diff --git a/compiler/src/iree/compiler/Codegen/SPIRV/test/tile_and_vectorize_matmul.mlir b/compiler/src/iree/compiler/Codegen/SPIRV/test/tile_and_vectorize_matmul.mlir
index 8ab2a26..fd5011a 100644
--- a/compiler/src/iree/compiler/Codegen/SPIRV/test/tile_and_vectorize_matmul.mlir
+++ b/compiler/src/iree/compiler/Codegen/SPIRV/test/tile_and_vectorize_matmul.mlir
@@ -1,4 +1,5 @@
-// RUN: iree-opt --split-input-file --pass-pipeline='builtin.module(hal.executable(hal.executable.variant(builtin.module(func.func(iree-spirv-tile,iree-spirv-vectorize)))))' %s | FileCheck %s
+// RUN: iree-opt --split-input-file \
+// RUN:   --pass-pipeline='builtin.module(hal.executable(hal.executable.variant(builtin.module(func.func(iree-spirv-tile,canonicalize,cse,iree-spirv-vectorize,canonicalize,cse)))))' %s | FileCheck %s
 
 #config = #iree_codegen.lowering_config<tile_sizes = [[8, 64], [8, 4], [0, 0, 4]]>
 #translation = #iree_codegen.translation_info<SPIRVBaseVectorize>
diff --git a/compiler/src/iree/compiler/Codegen/SPIRV/test/vectorize_matmul.mlir b/compiler/src/iree/compiler/Codegen/SPIRV/test/vectorize_matmul.mlir
index e9a735c..86f0b4e 100644
--- a/compiler/src/iree/compiler/Codegen/SPIRV/test/vectorize_matmul.mlir
+++ b/compiler/src/iree/compiler/Codegen/SPIRV/test/vectorize_matmul.mlir
@@ -1,4 +1,4 @@
-// RUN: iree-opt --split-input-file --iree-spirv-vectorize %s | FileCheck %s
+// RUN: iree-opt --split-input-file --iree-spirv-vectorize --canonicalize %s | FileCheck %s
 
 func.func @matmul_1x4x4(%lhs: tensor<1x4xf32>, %rhs: tensor<4x4xf32>, %init: tensor<1x4xf32>) -> tensor<1x4xf32> {
   %0 = linalg.matmul ins(%lhs, %rhs : tensor<1x4xf32>, tensor<4x4xf32>) outs(%init : tensor<1x4xf32>) -> tensor<1x4xf32>
diff --git a/llvm-external-projects/iree-dialects/include/iree-dialects/Dialect/LinalgExt/Transforms/Transforms.h b/llvm-external-projects/iree-dialects/include/iree-dialects/Dialect/LinalgExt/Transforms/Transforms.h
index 5194775..efba8ab 100644
--- a/llvm-external-projects/iree-dialects/include/iree-dialects/Dialect/LinalgExt/Transforms/Transforms.h
+++ b/llvm-external-projects/iree-dialects/include/iree-dialects/Dialect/LinalgExt/Transforms/Transforms.h
@@ -463,7 +463,7 @@
     if (failed(filter.checkAndNotify(rewriter, op)))
       return failure();
     linalg::LinalgPaddingPattern p(op.getContext(), options);
-    auto maybeRes = p.returningMatchAndRewrite(op, rewriter);
+    auto maybeRes = linalg::padAndHoistLinalgOp(rewriter, op, options);
     if (failed(maybeRes))
       return failure();
     filter.replaceLinalgTransformationFilter(rewriter, *maybeRes);
diff --git a/llvm-external-projects/iree-dialects/test/Dialect/linalg_transform/invalid.mlir b/llvm-external-projects/iree-dialects/test/Dialect/linalg_transform/invalid.mlir
index 412c292..8b8abc1 100644
--- a/llvm-external-projects/iree-dialects/test/Dialect/linalg_transform/invalid.mlir
+++ b/llvm-external-projects/iree-dialects/test/Dialect/linalg_transform/invalid.mlir
@@ -39,15 +39,6 @@
 transform.structured.canonicalized_sequence failures(propagate) {
 ^bb0(%arg0: !pdl.operation):
   %0 = pdl_match @match in %arg0 : (!pdl.operation) -> !pdl.operation
-  // expected-error@below {{expects hoist_paddings to contain positive integers, found [1, -7]}}
-  transform.structured.pad %0 {hoist_paddings=[1, -7]}
-}
-
-// -----
-
-transform.structured.canonicalized_sequence failures(propagate) {
-^bb0(%arg0: !pdl.operation):
-  %0 = pdl_match @match in %arg0 : (!pdl.operation) -> !pdl.operation
   // expected-error@below {{expects transpose_paddings to be a permutation, found [1, 1]}}
   transform.structured.pad %0 {transpose_paddings=[[1, 1]]}
 }
diff --git a/llvm-external-projects/iree-dialects/test/Dialect/linalg_transform/selective-targeting.mlir b/llvm-external-projects/iree-dialects/test/Dialect/linalg_transform/selective-targeting.mlir
index f20d53c..4bfa83d 100644
--- a/llvm-external-projects/iree-dialects/test/Dialect/linalg_transform/selective-targeting.mlir
+++ b/llvm-external-projects/iree-dialects/test/Dialect/linalg_transform/selective-targeting.mlir
@@ -7,7 +7,7 @@
     -> tensor<128x128xf32> {
   // This operation is marked for tiling only.
   // CHECK-COUNT-3: scf.for
-  // CHECK-COUNT-3: tensor.extract_slice
+  // CHECK-COUNT-2: tensor.extract_slice
   // CHECK: linalg.matmul
   // CHECK-SAME: -> tensor<4x4xf32>
   %0 = linalg.matmul { test.attrA }
diff --git a/third_party/llvm-project b/third_party/llvm-project
index bc8de51..523640f 160000
--- a/third_party/llvm-project
+++ b/third_party/llvm-project
@@ -1 +1 @@
-Subproject commit bc8de519ea6d47a6d1602508eb24594493e9912e
+Subproject commit 523640f7a4c0b038ce630939af161fdfa964dba4