Integrate llvm-project at 33cf40122279342b50f92a3a53f5c185390b6018 (#12475)

* Reset third_party/llvm-project:
33cf40122279342b50f92a3a53f5c185390b6018 (2023-03-02 13:05:15 -0500):
[libc++][NFC] Reformat aligned_storage specialization macro
* Reset third_party/mlir-hlto: 4ceea1d9ae3c3f87071e2096c91f38da75d22242
(2023-03-02 12:43:52 -0800): [THLO] Add MemoryEffectOpInterface to all
DPS ops.
* Note: upstream hoisting on tensors does not canonicalize `scf.for`
anymore, run canonicalization to make this test happy.
* Note: upstream type/attribute parsing requires null-terminated strings
as of https://reviews.llvm.org/D144804
* Note: python pass manager runs on operations instead of modules as of
https://reviews.llvm.org/D143356

benchmarks: x86_64, cuda, comp-stats
diff --git a/compiler/src/iree/compiler/API/python/test/transforms/ireec/compile_sample_module.py b/compiler/src/iree/compiler/API/python/test/transforms/ireec/compile_sample_module.py
index 492efb3..ef584f1 100644
--- a/compiler/src/iree/compiler/API/python/test/transforms/ireec/compile_sample_module.py
+++ b/compiler/src/iree/compiler/API/python/test/transforms/ireec/compile_sample_module.py
@@ -43,7 +43,7 @@
   print(options)
   pm = passmanager.PassManager(anchor_op="builtin.module")
   ireec.build_iree_vm_pass_pipeline(options, pm)
-  pm.run(input_module)
+  pm.run(input_module.operation)
 
   print(input_module)
   bytecode_io = io.BytesIO()
diff --git a/compiler/src/iree/compiler/API2/api_exports.c b/compiler/src/iree/compiler/API2/api_exports.c
index c82f363..7b34496 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();
@@ -434,6 +435,7 @@
 extern void mlirOperationPrintWithFlags();
 extern void mlirOperationRemoveAttributeByName();
 extern void mlirOperationRemoveFromParent();
+extern void mlirOperationCreateParse();
 extern void mlirOperationSetAttributeByName();
 extern void mlirOperationSetOperand();
 extern void mlirOperationStateAddAttributes();
@@ -460,7 +462,7 @@
 extern void mlirPassManagerEnableVerifier();
 extern void mlirPassManagerGetAsOpPassManager();
 extern void mlirPassManagerGetNestedUnder();
-extern void mlirPassManagerRun();
+extern void mlirPassManagerRunOnOp();
 extern void mlirPrintPassPipeline();
 extern void mlirRankedTensorTypeGet();
 extern void mlirRankedTensorTypeGetChecked();
@@ -970,6 +972,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;
@@ -1016,6 +1019,7 @@
   x += (uintptr_t)&mlirOperationPrintWithFlags;
   x += (uintptr_t)&mlirOperationRemoveAttributeByName;
   x += (uintptr_t)&mlirOperationRemoveFromParent;
+  x += (uintptr_t)&mlirOperationCreateParse;
   x += (uintptr_t)&mlirOperationSetAttributeByName;
   x += (uintptr_t)&mlirOperationSetOperand;
   x += (uintptr_t)&mlirOperationStateAddAttributes;
@@ -1042,7 +1046,7 @@
   x += (uintptr_t)&mlirPassManagerEnableVerifier;
   x += (uintptr_t)&mlirPassManagerGetAsOpPassManager;
   x += (uintptr_t)&mlirPassManagerGetNestedUnder;
-  x += (uintptr_t)&mlirPassManagerRun;
+  x += (uintptr_t)&mlirPassManagerRunOnOp;
   x += (uintptr_t)&mlirPrintPassPipeline;
   x += (uintptr_t)&mlirRankedTensorTypeGet;
   x += (uintptr_t)&mlirRankedTensorTypeGetChecked;
diff --git a/compiler/src/iree/compiler/API2/api_exports.def b/compiler/src/iree/compiler/API2/api_exports.def
index 6e91e69..66799e6 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
@@ -396,6 +397,7 @@
   mlirOpaqueTypeGetDialectNamespace
   mlirOperationClone
   mlirOperationCreate
+  mlirOperationCreateParse
   mlirOperationDestroy
   mlirOperationDump
   mlirOperationEqual
@@ -452,7 +454,7 @@
   mlirPassManagerEnableVerifier
   mlirPassManagerGetAsOpPassManager
   mlirPassManagerGetNestedUnder
-  mlirPassManagerRun
+  mlirPassManagerRunOnOp
   mlirPrintPassPipeline
   mlirRankedTensorTypeGet
   mlirRankedTensorTypeGetChecked
diff --git a/compiler/src/iree/compiler/API2/api_exports.ld b/compiler/src/iree/compiler/API2/api_exports.ld
index 55522d7..914cca4 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;
@@ -397,6 +398,7 @@
     mlirOpaqueTypeGetDialectNamespace;
     mlirOperationClone;
     mlirOperationCreate;
+    mlirOperationCreateParse;
     mlirOperationDestroy;
     mlirOperationDump;
     mlirOperationEqual;
@@ -453,7 +455,7 @@
     mlirPassManagerEnableVerifier;
     mlirPassManagerGetAsOpPassManager;
     mlirPassManagerGetNestedUnder;
-    mlirPassManagerRun;
+    mlirPassManagerRunOnOp;
     mlirPrintPassPipeline;
     mlirRankedTensorTypeGet;
     mlirRankedTensorTypeGetChecked;
diff --git a/compiler/src/iree/compiler/API2/api_exports.macos.lst b/compiler/src/iree/compiler/API2/api_exports.macos.lst
index 40d66a0..0c316d6 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
@@ -395,6 +396,7 @@
 _mlirOpaqueTypeGetDialectNamespace
 _mlirOperationClone
 _mlirOperationCreate
+_mlirOperationCreateParse
 _mlirOperationDestroy
 _mlirOperationDump
 _mlirOperationEqual
@@ -451,7 +453,7 @@
 _mlirPassManagerEnableVerifier
 _mlirPassManagerGetAsOpPassManager
 _mlirPassManagerGetNestedUnder
-_mlirPassManagerRun
+_mlirPassManagerRunOnOp
 _mlirPrintPassPipeline
 _mlirRankedTensorTypeGet
 _mlirRankedTensorTypeGetChecked
diff --git a/compiler/src/iree/compiler/API2/test/api-test-main.c b/compiler/src/iree/compiler/API2/test/api-test-main.c
index 63bd5b4..740c3e9 100644
--- a/compiler/src/iree/compiler/API2/test/api-test-main.c
+++ b/compiler/src/iree/compiler/API2/test/api-test-main.c
@@ -84,7 +84,7 @@
   MlirPassManager pass = mlirPassManagerCreate(context);
   MlirOpPassManager op_pass = mlirPassManagerGetAsOpPassManager(pass);
   ireeCompilerBuildIREEVMPassPipeline(options, op_pass);
-  status = mlirPassManagerRun(pass, module);
+  status = mlirPassManagerRunOnOp(pass, mlirModuleGetOperation(module));
   if (mlirLogicalResultIsFailure(status)) {
     mlirPassManagerDestroy(pass);
     ireeCompilerOptionsDestroy(options);
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/compiler/src/iree/compiler/Dialect/Flow/Conversion/TensorToFlow/BUILD b/compiler/src/iree/compiler/Dialect/Flow/Conversion/TensorToFlow/BUILD
index 7759553..c443f3f 100644
--- a/compiler/src/iree/compiler/Dialect/Flow/Conversion/TensorToFlow/BUILD
+++ b/compiler/src/iree/compiler/Dialect/Flow/Conversion/TensorToFlow/BUILD
@@ -26,6 +26,7 @@
         "//compiler/src/iree/compiler/Dialect/Flow/IR",
         "@llvm-project//llvm:Support",
         "@llvm-project//mlir:ArithDialect",
+        "@llvm-project//mlir:ArithUtils",
         "@llvm-project//mlir:FuncDialect",
         "@llvm-project//mlir:IR",
         "@llvm-project//mlir:LinalgDialect",
diff --git a/compiler/src/iree/compiler/Dialect/Flow/Conversion/TensorToFlow/CMakeLists.txt b/compiler/src/iree/compiler/Dialect/Flow/Conversion/TensorToFlow/CMakeLists.txt
index a34a3d3..c8fe234 100644
--- a/compiler/src/iree/compiler/Dialect/Flow/Conversion/TensorToFlow/CMakeLists.txt
+++ b/compiler/src/iree/compiler/Dialect/Flow/Conversion/TensorToFlow/CMakeLists.txt
@@ -22,6 +22,7 @@
   DEPS
     LLVMSupport
     MLIRArithDialect
+    MLIRArithUtils
     MLIRFuncDialect
     MLIRIR
     MLIRLinalgDialect
diff --git a/compiler/src/iree/compiler/Dialect/Flow/Conversion/TensorToFlow/Utils.cpp b/compiler/src/iree/compiler/Dialect/Flow/Conversion/TensorToFlow/Utils.cpp
index 5e62a1a..566ec3d 100644
--- a/compiler/src/iree/compiler/Dialect/Flow/Conversion/TensorToFlow/Utils.cpp
+++ b/compiler/src/iree/compiler/Dialect/Flow/Conversion/TensorToFlow/Utils.cpp
@@ -8,6 +8,7 @@
 
 #include "iree/compiler/Dialect/Flow/IR/FlowDialect.h"
 #include "iree/compiler/Dialect/Flow/IR/FlowOps.h"
+#include "mlir/Dialect/Arith/Utils/Utils.h"
 #include "mlir/Dialect/Tensor/IR/Tensor.h"
 #include "mlir/Dialect/Tensor/Utils/Utils.h"
 
@@ -56,7 +57,7 @@
     auto attr = valueOrAttr.dyn_cast<Attribute>();
     return attr ? attr.cast<IntegerAttr>().getInt() : dynamicVal;
   };
-  /// To ensure contiguity, start from the least signficant dimension. As long
+  /// To ensure contiguity, start from the least significant dimension. As long
   /// as the inner slices are "full slices", the current slice can be any offset
   /// and size. If the inner slices are not "full slices", the current slice
   /// must be of size 1. All strides must be one.
@@ -122,7 +123,8 @@
         loc, sourceType, source, sourceDynamicDims, sourceDynamicDims);
   }
 
-  auto offsetVals = getAsValues(rewriter, loc, insertOp.getMixedOffsets());
+  auto offsetVals = getValueOrCreateConstantIndexOp(rewriter, loc,
+                                                    insertOp.getMixedOffsets());
   Value dest = insertOp.getDest();
   auto destDynamicDims = tensor::createDynamicDimValues(rewriter, loc, dest);
   rewriter.replaceOpWithNewOp<TensorUpdateOp>(
@@ -161,8 +163,8 @@
         RankedTensorType::get(unreducedShape, sourceType.getElementType());
   }
 
-  auto offsetVals = getAsValues(rewriter, loc, offsets);
-  auto sizeVals = getAsValues(rewriter, loc, sizes);
+  auto offsetVals = getValueOrCreateConstantIndexOp(rewriter, loc, offsets);
+  auto sizeVals = getValueOrCreateConstantIndexOp(rewriter, loc, sizes);
   auto sourceDynamicDims =
       tensor::createDynamicDimValues(rewriter, loc, sliceOp.getSource());
   auto resultDynamicDims = getDynamicValues(sizes);
diff --git a/compiler/src/iree/compiler/Dialect/VM/IR/VMDialect.cpp b/compiler/src/iree/compiler/Dialect/VM/IR/VMDialect.cpp
index dd0fa3e..d919419 100644
--- a/compiler/src/iree/compiler/Dialect/VM/IR/VMDialect.cpp
+++ b/compiler/src/iree/compiler/Dialect/VM/IR/VMDialect.cpp
@@ -188,7 +188,8 @@
     if (spec == "?") {
       elementType = OpaqueType::get(getContext());
     } else {
-      elementType = mlir::parseType(spec, getContext());
+      // Make sure to pass a null-terminated string to the type parser.
+      elementType = mlir::parseType(spec.str(), getContext());
     }
     if (!elementType) {
       parser.emitError(parser.getCurrentLocation())
@@ -209,7 +210,8 @@
       return IREE::VM::RefType::getChecked(
           IREE::VM::OpaqueType::get(getContext()), loc);
     }
-    auto objectType = mlir::parseType(spec, getContext());
+    // Make sure to pass a null-terminated string to the type parser.
+    auto objectType = mlir::parseType(spec.str(), getContext());
     if (!objectType) {
       parser.emitError(parser.getCurrentLocation())
           << "invalid ref object type specification: '"
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/lib/Dialect/LinalgExt/IR/LinalgExtOps.cpp b/llvm-external-projects/iree-dialects/lib/Dialect/LinalgExt/IR/LinalgExtOps.cpp
index ceff4e8..915085d 100644
--- a/llvm-external-projects/iree-dialects/lib/Dialect/LinalgExt/IR/LinalgExtOps.cpp
+++ b/llvm-external-projects/iree-dialects/lib/Dialect/LinalgExt/IR/LinalgExtOps.cpp
@@ -1881,7 +1881,8 @@
 
   auto createLoad = [&]() -> Value {
     return builder.create<memref::LoadOp>(
-        loc, packOp.getInput(), getAsValues(builder, loc, sourceIndices));
+        loc, packOp.getInput(),
+        getValueOrCreateConstantIndexOp(builder, loc, sourceIndices));
   };
   Value scalar;
   if (auto paddingValue = packOp.getPaddingValue()) {
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
deleted file mode 100644
index f20d53c..0000000
--- a/llvm-external-projects/iree-dialects/test/Dialect/linalg_transform/selective-targeting.mlir
+++ /dev/null
@@ -1,160 +0,0 @@
-// RUN: iree-dialects-opt %s --transform-dialect-interpreter --split-input-file | FileCheck %s
-
-// CHECK-LABEL: func.func @matmul_tensors_1(
-func.func @matmul_tensors_1(
-  %arg0: tensor<128x128xf32>, %arg1: tensor<128x128xf32>,
-  %arg2: tensor<128x128xf32> {linalg.inplaceable = true})
-    -> tensor<128x128xf32> {
-  // This operation is marked for tiling only.
-  // CHECK-COUNT-3: scf.for
-  // CHECK-COUNT-3: tensor.extract_slice
-  // CHECK: linalg.matmul
-  // CHECK-SAME: -> tensor<4x4xf32>
-  %0 = linalg.matmul { test.attrA }
-                      ins(%arg0, %arg1: tensor<128x128xf32>, tensor<128x128xf32>)
-                     outs(%arg2: tensor<128x128xf32>)
-    -> tensor<128x128xf32>
-  func.return %0 : tensor<128x128xf32>
-}
-
-func.func @matmul_tensors_2(
-  %arg0: tensor<128x128xf32>, %arg1: tensor<128x128xf32>,
-  %arg2: tensor<128x128xf32> {linalg.inplaceable = true})
-    -> tensor<128x128xf32> {
-  // This operation is marked f
-  // This operation is marked for tiling and vectorization.
-  // Note that the loop-invariant read is hoisted out of the innermost loop.
-  // CHECK: scf.for
-  // CHECK:   scf.for
-  // CHECK:     vector.transfer_read
-  // CHECK:     scf.for
-  // CHECK:       vector.transfer_read
-  // CHECK:       vector.transfer_read
-  // CHECK:       vector.contract
-  // CHECK-NOT:   linalg.matmul
-  // CHECK:       vector.transfer_write
-  %0 = linalg.matmul { test.attrA, test.attrC }
-                      ins(%arg0, %arg1: tensor<128x128xf32>, tensor<128x128xf32>)
-                     outs(%arg2: tensor<128x128xf32>)
-    -> tensor<128x128xf32>
-  func.return %0 : tensor<128x128xf32>
-}
-
-func.func @matmul_tensors_3(
-  %arg0: tensor<128x128xf32>, %arg1: tensor<128x128xf32>,
-  %arg2: tensor<128x128xf32> {linalg.inplaceable = true})
-    -> tensor<128x128xf32> {
-  // This operation is marked for vectorization only.
-  // CHECK-NOT: scf.for
-  // CHECK-COUNT-3: vector.transfer_read
-  // CHECK: vector.contract
-  // CHECK-SAME: into vector<128x128xf32>
-  // CHECK: vector.transfer_write
-  %0 = linalg.matmul { test.attrC }
-                      ins(%arg0, %arg1: tensor<128x128xf32>, tensor<128x128xf32>)
-                     outs(%arg2: tensor<128x128xf32>)
-    -> tensor<128x128xf32>
-  func.return %0 : tensor<128x128xf32>
-}
-
-transform.with_pdl_patterns {
-^bb0(%arg0: !pdl.operation):
-  // Match matmul operations inside @matmul_tensors with test.attrA set.
-  pdl.pattern @pdl_target_attrA : benefit(1) {
-    %args = operands
-    %results = types
-    %attr = attribute
-    %0 = operation "linalg.matmul"(%args : !pdl.range<value>) {"test.attrA" = %attr}-> (%results : !pdl.range<type>)
-    // TODO: we don't want this, but it is the required terminator for pdl.pattern
-    rewrite %0 with "transform.dialect"
-  }
-
-  // Match matmul operations inside @matmul_tensors with test.attrC set.
-  pdl.pattern @pdl_target_attrC : benefit(1) {
-    %args = operands
-    %results = types
-    %attr = attribute
-    %0 = operation "linalg.matmul"(%args : !pdl.range<value>) {"test.attrC" = %attr}-> (%results : !pdl.range<type>)
-    // TODO: we don't want this, but it is the required terminator for pdl.pattern
-    rewrite %0 with "transform.dialect"
-  }
-
-  transform.structured.canonicalized_sequence %arg0 failures(propagate) {
-  ^bb1(%arg1: !pdl.operation):
-    %0 = pdl_match @pdl_target_attrA in %arg1 : (!pdl.operation) -> !pdl.operation
-    transform.structured.tile %0 [4, 4, 4]
-      : (!pdl.operation) -> (!pdl.operation, !pdl.operation, !pdl.operation, !pdl.operation)
-    %1 = pdl_match @pdl_target_attrC in %arg1 : (!pdl.operation) -> !pdl.operation
-    %2 = transform.get_closest_isolated_parent %1 : (!pdl.operation) -> !pdl.operation
-    transform.structured.vectorize %2
-  }
-}
-
-// -----
-
-// CHECK-LABEL: @vectorize_one
-func.func @vectorize_one(
-  %arg0: tensor<128x128xf32>, %arg1: tensor<128x128xf32>,
-  %arg2: tensor<128x128xf32> {linalg.inplaceable = true})
-    -> tensor<128x128xf32> {
-  // CHECK: vector.contract
-  %0 = linalg.matmul {test.attrA}
-                     ins(%arg0, %arg1: tensor<128x128xf32>, tensor<128x128xf32>)
-                     outs(%arg2: tensor<128x128xf32>)
-    -> tensor<128x128xf32>
-  func.return %0 : tensor<128x128xf32>
-}
-
-func.func @vectorize_none(
-  %arg0: tensor<128x128xf32>, %arg1: tensor<128x128xf32>,
-  %arg2: tensor<128x128xf32> {linalg.inplaceable = true})
-    -> tensor<128x128xf32> {
-  // CHECK: linalg.matmul
-  %0 = linalg.matmul ins(%arg0, %arg1: tensor<128x128xf32>, tensor<128x128xf32>)
-                     outs(%arg2: tensor<128x128xf32>)
-    -> tensor<128x128xf32>
-  func.return %0 : tensor<128x128xf32>
-}
-
-transform.with_pdl_patterns {
-^bb0(%arg0: !pdl.operation):
-  pdl.pattern @pdl_target : benefit(1) {
-    %args = operands
-    %results = types
-    %attr = attribute
-    %0 = operation "linalg.matmul"(%args : !pdl.range<value>) {"test.attrA" = %attr}-> (%results : !pdl.range<type>)
-    // TODO: we don't want this, but it is the required terminator for pdl.pattern
-    rewrite %0 with "transform.dialect"
-  }
-
-  transform.structured.canonicalized_sequence %arg0 failures(propagate) {
-  ^bb1(%arg1: !pdl.operation):
-    %0 = pdl_match @pdl_target in %arg1 : (!pdl.operation) -> !pdl.operation
-    %1 = get_closest_isolated_parent %0 : (!pdl.operation) -> !pdl.operation
-    transform.structured.vectorize %1
-  }
-}
-
-// -----
-
-// CHECK-LABEL: @vectorize_all
-func.func @vectorize_all(
-  %arg0: tensor<128x128xf32>, %arg1: tensor<128x128xf32>, %arg2: tensor<128x128xf32>,
-  %arg3: tensor<128x128xf32> {linalg.inplaceable = true})
-    -> tensor<128x128xf32> {
-  // CHECK: vector.contract
-  %0 = linalg.matmul {test.attrA}
-                     ins(%arg0, %arg1: tensor<128x128xf32>, tensor<128x128xf32>)
-                     outs(%arg2: tensor<128x128xf32>)
-    -> tensor<128x128xf32>
-  // CHECK: vector.contract
-  %1 = linalg.matmul ins(%arg0, %0: tensor<128x128xf32>, tensor<128x128xf32>)
-                     outs(%arg3: tensor<128x128xf32>)
-    -> tensor<128x128xf32>
-  return %1 : tensor<128x128xf32>
-}
-
-transform.structured.canonicalized_sequence failures(propagate) {
-^bb0(%arg0: !pdl.operation):
-  transform.structured.vectorize %arg0
-}
diff --git a/third_party/llvm-project b/third_party/llvm-project
index bc8de51..33cf401 160000
--- a/third_party/llvm-project
+++ b/third_party/llvm-project
@@ -1 +1 @@
-Subproject commit bc8de519ea6d47a6d1602508eb24594493e9912e
+Subproject commit 33cf40122279342b50f92a3a53f5c185390b6018
diff --git a/third_party/mlir-hlo b/third_party/mlir-hlo
index 5e4debc..4ceea1d 160000
--- a/third_party/mlir-hlo
+++ b/third_party/mlir-hlo
@@ -1 +1 @@
-Subproject commit 5e4debc247e1ff153d7643482d71c861007a7bec
+Subproject commit 4ceea1d9ae3c3f87071e2096c91f38da75d22242