Integrate llvm-project at a54d028895c91da356a4aaf30e27a5a5b90dd313 (#8536)

* Reset third_party/llvm-project: a54d028895c91da356a4aaf30e27a5a5b90dd313 (2022-03-09 17:04:18 -0500): Revert "[libc++] Remove extension to support allocator<const T>"

MHLO commit : f52e7dc1210dead4d3ff416696cad1c794332959
TF Commit : 58b667263ba5734ba175a7640f1a1d572e52bd3d
Piper CL : 433732413

- Patch LLVM submodule to account for an upstream bug. Will be fixed by reviews.llvm.org/D121648
- Fix .body() -> .getBodyRegion() in iree-dialects.
- Fix .body() to .getBodyRegion() in integrations/tensorflow.

Co-authored-by: Nicolas Vasilache <ntv@google.com>
diff --git a/integrations/tensorflow/WORKSPACE b/integrations/tensorflow/WORKSPACE
index c9c5fe3..3cd4a16 100644
--- a/integrations/tensorflow/WORKSPACE
+++ b/integrations/tensorflow/WORKSPACE
@@ -7,7 +7,7 @@
 
 load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
 
-TENSORFLOW_COMMIT = "d2fbfb8f8ecf618d778900b53e6bddaf71bfd961"
+TENSORFLOW_COMMIT = "58b667263ba5734ba175a7640f1a1d572e52bd3d"
 
 git_repository(
     name = "org_tensorflow",
diff --git a/integrations/tensorflow/iree-dialects/lib/Dialect/PyDM/Transforms/Optimize/LocalPropagateTypes.cpp b/integrations/tensorflow/iree-dialects/lib/Dialect/PyDM/Transforms/Optimize/LocalPropagateTypes.cpp
index 0836591..099aba7 100644
--- a/integrations/tensorflow/iree-dialects/lib/Dialect/PyDM/Transforms/Optimize/LocalPropagateTypes.cpp
+++ b/integrations/tensorflow/iree-dialects/lib/Dialect/PyDM/Transforms/Optimize/LocalPropagateTypes.cpp
@@ -187,7 +187,7 @@
   // cache, it is possible to refinements that include type cycles in the CFG.
   void permuteRefinedBlocks(PermutedTypePropagator &propagator) {
     SmallVector<Block *> blocks;
-    for (auto &block : getOperation().body()) {
+    for (auto &block : getOperation().getBodyRegion()) {
       blocks.push_back(&block);
     }
 
diff --git a/integrations/tensorflow/iree_tf_compiler/TFL/LowerGlobalTensors.cpp b/integrations/tensorflow/iree_tf_compiler/TFL/LowerGlobalTensors.cpp
index ade6f81..f7765a1 100644
--- a/integrations/tensorflow/iree_tf_compiler/TFL/LowerGlobalTensors.cpp
+++ b/integrations/tensorflow/iree_tf_compiler/TFL/LowerGlobalTensors.cpp
@@ -33,7 +33,7 @@
   void runOnOperation() override {
     auto* context = &getContext();
     auto moduleOp = getOperation();
-    mlir::OpBuilder builder(moduleOp.body());
+    mlir::OpBuilder builder(moduleOp.getBodyRegion());
 
     DenseMap<StringRef, FuncOp> symNameToFunction;
     for (auto func : moduleOp.getOps<FuncOp>()) {
diff --git a/iree/compiler/Dialect/Flow/IR/PartitionableLoopsInterface.cpp b/iree/compiler/Dialect/Flow/IR/PartitionableLoopsInterface.cpp
index 115224e..b6aca9e 100644
--- a/iree/compiler/Dialect/Flow/IR/PartitionableLoopsInterface.cpp
+++ b/iree/compiler/Dialect/Flow/IR/PartitionableLoopsInterface.cpp
@@ -205,7 +205,6 @@
   ::mlir::linalg::PoolingNhwcSumOp,
   ::mlir::linalg::QuantizedBatchMatmulOp,
   ::mlir::linalg::QuantizedMatmulOp,
-  ::mlir::linalg::SoftPlus2DOp,
   ::mlir::linalg::VecmatOp
   >(registry);
   // clang-format on
diff --git a/iree/compiler/Dialect/Stream/Conversion/FlowToStream/ConvertFlowToStream.cpp b/iree/compiler/Dialect/Stream/Conversion/FlowToStream/ConvertFlowToStream.cpp
index dc4f9e5..e1cb883 100644
--- a/iree/compiler/Dialect/Stream/Conversion/FlowToStream/ConvertFlowToStream.cpp
+++ b/iree/compiler/Dialect/Stream/Conversion/FlowToStream/ConvertFlowToStream.cpp
@@ -385,7 +385,8 @@
 
     // Move the original nested module body into the new executable directly.
     auto moduleOp = rewriter.cloneWithoutRegions(flowOp.getInnerModule());
-    streamOp.getInnerModule().body().takeBody(flowOp.getInnerModule().body());
+    streamOp.getInnerModule().getBodyRegion().takeBody(
+        flowOp.getInnerModule().getBodyRegion());
 
     // Update the entry point signatures in the module.
     // Dispatch tensor arguments become bindings and all others are preserved as
diff --git a/iree/compiler/Dialect/Stream/Transforms/AnnotateDispatchArguments.cpp b/iree/compiler/Dialect/Stream/Transforms/AnnotateDispatchArguments.cpp
index 84e577a..08b65e9 100644
--- a/iree/compiler/Dialect/Stream/Transforms/AnnotateDispatchArguments.cpp
+++ b/iree/compiler/Dialect/Stream/Transforms/AnnotateDispatchArguments.cpp
@@ -540,7 +540,7 @@
 
     // Annotate the exported dispatch functions.
     for (auto executableOp :
-         getOperation().body().getOps<IREE::Stream::ExecutableOp>()) {
+         getOperation().getBodyRegion().getOps<IREE::Stream::ExecutableOp>()) {
       for (auto exportOp :
            executableOp.getOps<IREE::Stream::ExecutableExportOp>()) {
         annotateExport(executableOp, exportOp, analysis);
diff --git a/iree/compiler/Dialect/Stream/Transforms/FoldUniformOperands.cpp b/iree/compiler/Dialect/Stream/Transforms/FoldUniformOperands.cpp
index f0551bd..b4ea95f 100644
--- a/iree/compiler/Dialect/Stream/Transforms/FoldUniformOperands.cpp
+++ b/iree/compiler/Dialect/Stream/Transforms/FoldUniformOperands.cpp
@@ -272,7 +272,7 @@
 
     // Optimize each dispatch op.
     for (auto executableOp :
-         getOperation().body().getOps<IREE::Stream::ExecutableOp>()) {
+         getOperation().getBodyRegion().getOps<IREE::Stream::ExecutableOp>()) {
       for (auto exportOp :
            executableOp.getOps<IREE::Stream::ExecutableExportOp>()) {
         auto &dispatchOps = entryDispatchMap[exportOp];
diff --git a/iree/compiler/Dialect/Stream/Transforms/FuseDispatchBindings.cpp b/iree/compiler/Dialect/Stream/Transforms/FuseDispatchBindings.cpp
index 8111382..e55e705 100644
--- a/iree/compiler/Dialect/Stream/Transforms/FuseDispatchBindings.cpp
+++ b/iree/compiler/Dialect/Stream/Transforms/FuseDispatchBindings.cpp
@@ -438,7 +438,7 @@
     // as source material.
     MemoizedCmdZeros memoizedZeros;
     for (auto executableOp :
-         getOperation().body().getOps<IREE::Stream::ExecutableOp>()) {
+         getOperation().getBodyRegion().getOps<IREE::Stream::ExecutableOp>()) {
       for (auto exportOp :
            executableOp.getOps<IREE::Stream::ExecutableExportOp>()) {
         fuseDispatchBindings(executableOp, exportOp, entryDispatchMap[exportOp],
diff --git a/iree/compiler/Dialect/Stream/Transforms/SpecializeDispatches.cpp b/iree/compiler/Dialect/Stream/Transforms/SpecializeDispatches.cpp
index 0149ea7..75bc1bf 100644
--- a/iree/compiler/Dialect/Stream/Transforms/SpecializeDispatches.cpp
+++ b/iree/compiler/Dialect/Stream/Transforms/SpecializeDispatches.cpp
@@ -352,7 +352,7 @@
     // Optimize each dispatchable function and its dispatch sites.
     MemoizedCmdConstants memoizedConstants;
     for (auto executableOp :
-         getOperation().body().getOps<IREE::Stream::ExecutableOp>()) {
+         getOperation().getBodyRegion().getOps<IREE::Stream::ExecutableOp>()) {
       for (auto exportOp :
            executableOp.getOps<IREE::Stream::ExecutableExportOp>()) {
         specializeDispatches(executableOp, exportOp, entryDispatchMap[exportOp],
diff --git a/iree/compiler/InputConversion/MHLO/LegalizeInputTypes.cpp b/iree/compiler/InputConversion/MHLO/LegalizeInputTypes.cpp
index 40217da..04264ae 100644
--- a/iree/compiler/InputConversion/MHLO/LegalizeInputTypes.cpp
+++ b/iree/compiler/InputConversion/MHLO/LegalizeInputTypes.cpp
@@ -220,7 +220,7 @@
     FlowTypeConverter typeConverter;
 
     auto oldOps = llvm::to_vector<4>(llvm::map_range(
-        moduleOp.body().getOps(), [](Operation &op) { return &op; }));
+        moduleOp.getBodyRegion().getOps(), [](Operation &op) { return &op; }));
     for (auto *oldOp : oldOps) {
       OpBuilder moduleBuilder(moduleOp);
       moduleBuilder.setInsertionPoint(oldOp);
diff --git a/third_party/llvm-project b/third_party/llvm-project
index 49a29e5..c38fadb 160000
--- a/third_party/llvm-project
+++ b/third_party/llvm-project
@@ -1 +1 @@
-Subproject commit 49a29e5c9f8f358a2168ad5488ba6959d94525d3
+Subproject commit c38fadb7f97e8aca077df9c2a01ec43f8cb1f805
diff --git a/third_party/mlir-hlo b/third_party/mlir-hlo
index b8c0f89..f52e7dc 160000
--- a/third_party/mlir-hlo
+++ b/third_party/mlir-hlo
@@ -1 +1 @@
-Subproject commit b8c0f896d4d78c9fb0c97c82dbd9f25d235056e2
+Subproject commit f52e7dc1210dead4d3ff416696cad1c794332959