Integrate LLVM at llvm/llvm-project@e9c9ee9fe694

Updates LLVM usage to match
[e9c9ee9fe694](https://github.com/llvm/llvm-project/commit/e9c9ee9fe694)

PiperOrigin-RevId: 435187843
diff --git a/tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/gml_st/IR/gml_st_ops.td b/tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/gml_st/IR/gml_st_ops.td
index 5d15e57..90497b7 100644
--- a/tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/gml_st/IR/gml_st_ops.td
+++ b/tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/gml_st/IR/gml_st_ops.td
@@ -18,6 +18,7 @@
 #ifndef GML_ST_OPS
 #define GML_ST_OPS
 
+include "mlir/IR/AttrTypeBase.td"
 include "mlir/IR/OpBase.td"
 include "mlir-hlo/Dialect/gml_st/IR/gml_st_ops_base.td"
 include "mlir/Interfaces/InferTypeOpInterface.td"
diff --git a/tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops_base.td b/tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops_base.td
index 9040484..4e8d613 100644
--- a/tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops_base.td
+++ b/tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops_base.td
@@ -16,6 +16,7 @@
 #ifndef HLO_OPS_BASE
 #define HLO_OPS_BASE
 
+include "mlir/IR/AttrTypeBase.td"
 include "mlir/IR/OpBase.td"
 
 def HLO_Dialect : Dialect {
diff --git a/tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops_base_attrs.td b/tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops_base_attrs.td
index fc45d88..fc04dae 100644
--- a/tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops_base_attrs.td
+++ b/tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops_base_attrs.td
@@ -30,6 +30,7 @@
       HLODim:$scatterDimsToOperandDims,
       "int64_t":$indexVectorDim
   );
+  let hasCustomAssemblyFormat = 1;
 }
 
 def GatherDimensionNumbers : AttrDef<HLO_Dialect, "GatherDimensionNumbers"> {
@@ -41,6 +42,7 @@
       HLODim:$startIndexMap,
       "int64_t":$indexVectorDim
   );
+  let hasCustomAssemblyFormat = 1;
 }
 
 def DotDimensionNumbers : AttrDef<HLO_Dialect, "DotDimensionNumbers"> {
@@ -52,6 +54,7 @@
       HLODim:$lhsContractingDimensions,
       HLODim:$rhsContractingDimensions
   );
+  let hasCustomAssemblyFormat = 1;
 }
 
 def ConvDimensionNumbers : AttrDef<HLO_Dialect, "ConvDimensionNumbers"> {
@@ -69,6 +72,7 @@
     "int64_t":$outputFeatureDimension,
     HLODim:$outputSpatialDimensions
   );
+  let hasCustomAssemblyFormat = 1;
 }
 
 def ArgResultAlias : AttrDef<HLO_Dialect, "ArgResultAlias"> {
@@ -98,6 +102,7 @@
     HLODim:$resultTupleIndices,
     "bool":$isMustAlias
   );
+  let hasCustomAssemblyFormat = 1;
 }
 
 #endif // HLO_OPS_BASE_ATTRS
diff --git a/tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops_base_enums.td b/tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops_base_enums.td
index 30d1442..fb6ad03 100644
--- a/tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops_base_enums.td
+++ b/tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops_base_enums.td
@@ -17,6 +17,7 @@
 #define HLO_OPS_BASE_ENUMS
 
 include "mlir/IR/EnumAttr.td"
+include "mlir/IR/PatternBase.td"
 
 //===----------------------------------------------------------------------===//
 // Precision Config enum definitions.
diff --git a/tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/mhlo/transforms/bufferizable_op_interface_impl.h b/tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/mhlo/transforms/bufferizable_op_interface_impl.h
index 8270403..1f1220e 100644
--- a/tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/mhlo/transforms/bufferizable_op_interface_impl.h
+++ b/tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/mhlo/transforms/bufferizable_op_interface_impl.h
@@ -24,10 +24,9 @@
 namespace mlir {
 namespace mhlo {
 
-/// mhlo dialect bufferization state. mhlo-specific bufferization options are
+/// mhlo dialect analysis state. mhlo-specific bufferization options are
 /// stored in this state.
-struct MhloBufferizationState
-    : public bufferization::DialectBufferizationState {
+struct MhloBufferizationState : public bufferization::DialectAnalysisState {
   using EnforceIdentityMapFn = std::function<bool(Operation *)>;
 
   /// If this function returns true for an op, copies will be inserted when
diff --git a/tensorflow/compiler/mlir/hlo/lib/Dialect/mhlo/transforms/hlo_legalize_to_memref.cc b/tensorflow/compiler/mlir/hlo/lib/Dialect/mhlo/transforms/hlo_legalize_to_memref.cc
index aa07717..e1f83c7 100644
--- a/tensorflow/compiler/mlir/hlo/lib/Dialect/mhlo/transforms/hlo_legalize_to_memref.cc
+++ b/tensorflow/compiler/mlir/hlo/lib/Dialect/mhlo/transforms/hlo_legalize_to_memref.cc
@@ -69,7 +69,7 @@
   }
 
   LogicalResult bufferize(Operation *op, RewriterBase &rewriter,
-                          const BufferizationState &state) const {
+                          BufferizationState &state) const {
     auto reshape_op = cast<mhlo::ReshapeOp>(op);
     auto unranked_operand_type =
         reshape_op.operand().getType().dyn_cast<UnrankedTensorType>();
@@ -114,7 +114,7 @@
   }
 
   LogicalResult bufferize(Operation *op, RewriterBase &rewriter,
-                          const BufferizationState &state) const {
+                          BufferizationState &state) const {
     auto reshape_op = cast<mhlo::DynamicReshapeOp>(op);
 
     // The buffer still has the old (pre-reshape) type.
@@ -285,7 +285,7 @@
   }
 
   LogicalResult bufferize(Operation *op, RewriterBase &rewriter,
-                          const BufferizationState &state) const {
+                          BufferizationState &state) const {
     auto broadcast_in_dim_op = cast<mhlo::DynamicBroadcastInDimOp>(op);
     auto result_type =
         broadcast_in_dim_op.getType().dyn_cast<RankedTensorType>();
@@ -301,7 +301,7 @@
 
     // Evaluate `enforce_identity_map_fn` and maybe create a copy.
     Optional<const MhloBufferizationState *> dialect_state =
-        state.getDialectState<MhloBufferizationState>(
+        state.getAnalysisState().getDialectState<MhloBufferizationState>(
             mhlo::MhloDialect::getDialectNamespace());
     assert(dialect_state.hasValue() && "mhlo dialect state not initialized");
     if ((*dialect_state)->enforce_identity_map_fn(op)) {
diff --git a/tensorflow/compiler/mlir/lite/experimental/tac/transforms/transform_patterns.td b/tensorflow/compiler/mlir/lite/experimental/tac/transforms/transform_patterns.td
index b843795..fab86ad 100644
--- a/tensorflow/compiler/mlir/lite/experimental/tac/transforms/transform_patterns.td
+++ b/tensorflow/compiler/mlir/lite/experimental/tac/transforms/transform_patterns.td
@@ -14,6 +14,7 @@
 ==============================================================================*/
 
 include "mlir/IR/OpBase.td"
+include "mlir/IR/PatternBase.td"
 include "mlir/Dialect/Arithmetic/IR/ArithmeticOps.td"
 include "mlir/Dialect/Func/IR/FuncOps.td"
 include "tensorflow/compiler/mlir/lite/ir/tfl_ops.td"
diff --git a/tensorflow/compiler/mlir/lite/quantization/tensorflow/fallback_to_flex_patterns.td b/tensorflow/compiler/mlir/lite/quantization/tensorflow/fallback_to_flex_patterns.td
index c49082e..b4e60d7 100644
--- a/tensorflow/compiler/mlir/lite/quantization/tensorflow/fallback_to_flex_patterns.td
+++ b/tensorflow/compiler/mlir/lite/quantization/tensorflow/fallback_to_flex_patterns.td
@@ -14,6 +14,7 @@
 ==============================================================================*/
 
 include "mlir/IR/OpBase.td"
+include "mlir/IR/PatternBase.td"
 include "mlir/Dialect/Func/IR/FuncOps.td"
 include "mlir/Dialect/Arithmetic/IR/ArithmeticOps.td"
 include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops.td"
diff --git a/tensorflow/compiler/mlir/lite/transforms/legalize_patterns.td b/tensorflow/compiler/mlir/lite/transforms/legalize_patterns.td
index 5e9d821..f5a69bd 100644
--- a/tensorflow/compiler/mlir/lite/transforms/legalize_patterns.td
+++ b/tensorflow/compiler/mlir/lite/transforms/legalize_patterns.td
@@ -16,6 +16,7 @@
 // TFLite legalization patterns
 
 include "mlir/IR/OpBase.td"
+include "mlir/IR/PatternBase.td"
 include "mlir/Dialect/Arithmetic/IR/ArithmeticOps.td"
 include "mlir/Dialect/Func/IR/FuncOps.td"
 include "tensorflow/compiler/mlir/lite/ir/tfl_ops.td"
diff --git a/tensorflow/compiler/mlir/lite/transforms/legalize_variables.td b/tensorflow/compiler/mlir/lite/transforms/legalize_variables.td
index 1abe7e7..5c26b6e 100644
--- a/tensorflow/compiler/mlir/lite/transforms/legalize_variables.td
+++ b/tensorflow/compiler/mlir/lite/transforms/legalize_variables.td
@@ -14,6 +14,7 @@
 ==============================================================================*/
 
 // TFLite variables legalization patterns
+include "mlir/IR/PatternBase.td"
 include "tensorflow/compiler/mlir/lite/ir/tfl_ops.td"
 include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops.td"
 
diff --git a/tensorflow/compiler/mlir/lite/transforms/optimize_patterns.td b/tensorflow/compiler/mlir/lite/transforms/optimize_patterns.td
index 61f029c..bd3441a 100644
--- a/tensorflow/compiler/mlir/lite/transforms/optimize_patterns.td
+++ b/tensorflow/compiler/mlir/lite/transforms/optimize_patterns.td
@@ -16,6 +16,7 @@
 // This is the optimization pattern definition file for TensorFlow Lite.
 
 include "mlir/IR/OpBase.td"
+include "mlir/IR/PatternBase.td"
 include "mlir/Dialect/Arithmetic/IR/ArithmeticOps.td"
 include "mlir/Dialect/Func/IR/FuncOps.td"
 include "tensorflow/compiler/mlir/lite/ir/tfl_ops.td"
diff --git a/tensorflow/compiler/mlir/lite/transforms/post_quantize_patterns.td b/tensorflow/compiler/mlir/lite/transforms/post_quantize_patterns.td
index 733bdfa..4006f71 100644
--- a/tensorflow/compiler/mlir/lite/transforms/post_quantize_patterns.td
+++ b/tensorflow/compiler/mlir/lite/transforms/post_quantize_patterns.td
@@ -16,6 +16,7 @@
 // This is the quantization pattern definition file for TensorFlow Lite.
 
 include "mlir/IR/OpBase.td"
+include "mlir/IR/PatternBase.td"
 include "mlir/Dialect/Func/IR/FuncOps.td"
 include "tensorflow/compiler/mlir/lite/ir/tfl_ops.td"
 
diff --git a/tensorflow/compiler/mlir/lite/transforms/quantize_patterns.td b/tensorflow/compiler/mlir/lite/transforms/quantize_patterns.td
index 93a9182..84940ed 100644
--- a/tensorflow/compiler/mlir/lite/transforms/quantize_patterns.td
+++ b/tensorflow/compiler/mlir/lite/transforms/quantize_patterns.td
@@ -16,6 +16,7 @@
 // This is the quantization pattern definition file for TensorFlow Lite.
 
 include "mlir/IR/OpBase.td"
+include "mlir/IR/PatternBase.td"
 include "mlir/Dialect/Arithmetic/IR/ArithmeticOps.td"
 include "mlir/Dialect/Func/IR/FuncOps.td"
 include "tensorflow/compiler/mlir/lite/ir/tfl_ops.td"
diff --git a/tensorflow/compiler/mlir/lite/transforms/tensorlist_patterns.td b/tensorflow/compiler/mlir/lite/transforms/tensorlist_patterns.td
index fc0706b..31b5465 100644
--- a/tensorflow/compiler/mlir/lite/transforms/tensorlist_patterns.td
+++ b/tensorflow/compiler/mlir/lite/transforms/tensorlist_patterns.td
@@ -14,6 +14,7 @@
 ==============================================================================*/
 
 include "mlir/IR/OpBase.td"
+include "mlir/IR/PatternBase.td"
 include "mlir/Dialect/Func/IR/FuncOps.td"
 include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops.td"
 
diff --git a/tensorflow/compiler/mlir/quantization/tensorflow/passes/prepare_quantize.td b/tensorflow/compiler/mlir/quantization/tensorflow/passes/prepare_quantize.td
index 3f32cfb..5623065 100644
--- a/tensorflow/compiler/mlir/quantization/tensorflow/passes/prepare_quantize.td
+++ b/tensorflow/compiler/mlir/quantization/tensorflow/passes/prepare_quantize.td
@@ -15,6 +15,7 @@
 
 include "tensorflow/compiler/mlir/quantization/tensorflow/passes/utils.td"
 include "mlir/IR/OpBase.td"
+include "mlir/IR/PatternBase.td"
 include "mlir/Dialect/Func/IR/FuncOps.td"
 include "mlir/Dialect/Arithmetic/IR/ArithmeticOps.td"
 include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops.td"
diff --git a/tensorflow/compiler/mlir/quantization/tensorflow/passes/quantize_composite_functions.td b/tensorflow/compiler/mlir/quantization/tensorflow/passes/quantize_composite_functions.td
index ad853b1..5d59735 100644
--- a/tensorflow/compiler/mlir/quantization/tensorflow/passes/quantize_composite_functions.td
+++ b/tensorflow/compiler/mlir/quantization/tensorflow/passes/quantize_composite_functions.td
@@ -15,6 +15,7 @@
 
 include "tensorflow/compiler/mlir/quantization/tensorflow/passes/utils.td"
 include "mlir/IR/OpBase.td"
+include "mlir/IR/PatternBase.td"
 include "mlir/Dialect/Func/IR/FuncOps.td"
 include "mlir/Dialect/Arithmetic/IR/ArithmeticOps.td"
 include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops.td"
diff --git a/tensorflow/compiler/mlir/quantization/tensorflow/utils/lift_as_function_call_utils.td b/tensorflow/compiler/mlir/quantization/tensorflow/utils/lift_as_function_call_utils.td
index ed93bf0..cdcef38 100644
--- a/tensorflow/compiler/mlir/quantization/tensorflow/utils/lift_as_function_call_utils.td
+++ b/tensorflow/compiler/mlir/quantization/tensorflow/utils/lift_as_function_call_utils.td
@@ -14,6 +14,7 @@
 ==============================================================================*/
 
 include "mlir/IR/OpBase.td"
+include "mlir/IR/PatternBase.td"
 include "mlir/Dialect/Func/IR/FuncOps.td"
 
 // The `returns` number indicates the number of results the function returns.
diff --git a/tensorflow/compiler/mlir/tensorflow/transforms/optimize.td b/tensorflow/compiler/mlir/tensorflow/transforms/optimize.td
index 2758dfe..a09a3a5 100644
--- a/tensorflow/compiler/mlir/tensorflow/transforms/optimize.td
+++ b/tensorflow/compiler/mlir/tensorflow/transforms/optimize.td
@@ -13,6 +13,7 @@
 limitations under the License.
 ==============================================================================*/
 include "mlir/IR/OpBase.td"
+include "mlir/IR/PatternBase.td"
 include "mlir/Dialect/Arithmetic/IR/ArithmeticOps.td"
 include "mlir/Dialect/Func/IR/FuncOps.td"
 include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops.td"
diff --git a/tensorflow/compiler/mlir/tensorflow/transforms/reducer/tf_mlir_reduce_patterns.td b/tensorflow/compiler/mlir/tensorflow/transforms/reducer/tf_mlir_reduce_patterns.td
index ff2a516..43df13d 100644
--- a/tensorflow/compiler/mlir/tensorflow/transforms/reducer/tf_mlir_reduce_patterns.td
+++ b/tensorflow/compiler/mlir/tensorflow/transforms/reducer/tf_mlir_reduce_patterns.td
@@ -13,6 +13,7 @@
 limitations under the License.
 ==============================================================================*/
 include "mlir/IR/OpBase.td"
+include "mlir/IR/PatternBase.td"
 include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops.td"
 
 // Note that this may not be a valid transformation for general tensorflow
diff --git a/tensorflow/compiler/mlir/tensorflow/transforms/rewrite_util.td b/tensorflow/compiler/mlir/tensorflow/transforms/rewrite_util.td
index 4bd19f3..291ac90 100644
--- a/tensorflow/compiler/mlir/tensorflow/transforms/rewrite_util.td
+++ b/tensorflow/compiler/mlir/tensorflow/transforms/rewrite_util.td
@@ -17,6 +17,7 @@
 #define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_REWRITE_UTIL
 
 include "mlir/IR/OpBase.td"
+include "mlir/IR/PatternBase.td"
 
 // Here, the element type can be any integer or float type. But, note that only
 // 32 bit integers are supported for the values.
diff --git a/tensorflow/compiler/mlir/tensorflow/transforms/tf_data_optimization.td b/tensorflow/compiler/mlir/tensorflow/transforms/tf_data_optimization.td
index 3854a87..21c0a88 100644
--- a/tensorflow/compiler/mlir/tensorflow/transforms/tf_data_optimization.td
+++ b/tensorflow/compiler/mlir/tensorflow/transforms/tf_data_optimization.td
@@ -14,6 +14,7 @@
 ==============================================================================*/
 
 include "mlir/IR/OpBase.td"
+include "mlir/IR/PatternBase.td"
 include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops.td"
 
 // TODO(jpienaar): Move this somewhere general.
diff --git a/tensorflow/compiler/mlir/tfjs/transforms/optimize_pattern.td b/tensorflow/compiler/mlir/tfjs/transforms/optimize_pattern.td
index 811a534..1a90740 100644
--- a/tensorflow/compiler/mlir/tfjs/transforms/optimize_pattern.td
+++ b/tensorflow/compiler/mlir/tfjs/transforms/optimize_pattern.td
@@ -17,6 +17,7 @@
 
 include "tensorflow/compiler/mlir/tfjs/ir/tfjs_ops.td"
 include "mlir/IR/OpBase.td"
+include "mlir/IR/PatternBase.td"
 include "mlir/Dialect/Func/IR/FuncOps.td"
 include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops.td"
 
diff --git a/tensorflow/compiler/mlir/tfr/passes/decompose_patterns.td b/tensorflow/compiler/mlir/tfr/passes/decompose_patterns.td
index b544dd9..5e3ee7e 100644
--- a/tensorflow/compiler/mlir/tfr/passes/decompose_patterns.td
+++ b/tensorflow/compiler/mlir/tfr/passes/decompose_patterns.td
@@ -13,6 +13,7 @@
 limitations under the License.
 ==============================================================================*/
 include "mlir/IR/OpBase.td"
+include "mlir/IR/PatternBase.td"
 include "mlir/Dialect/Arithmetic/IR/ArithmeticOps.td"
 include "mlir/Dialect/Func/IR/FuncOps.td"
 include "tensorflow/compiler/mlir/tfr/ir/tfr_ops.td"
diff --git a/tensorflow/compiler/mlir/tools/kernel_gen/tests/tanh.mlir b/tensorflow/compiler/mlir/tools/kernel_gen/tests/tanh.mlir
index 44c2bd4..d02d078 100644
--- a/tensorflow/compiler/mlir/tools/kernel_gen/tests/tanh.mlir
+++ b/tensorflow/compiler/mlir/tools/kernel_gen/tests/tanh.mlir
@@ -12,8 +12,8 @@
 // TODO: Expand this pattern once things have stabilized.
 // CHECK-LABEL: @tanh
 func @tanh(%arg0: tensor<*xf32>) -> tensor<*xf32> {
-  // CHECK: scf.for
   // CHECK: alloc
+  // CHECK: scf.for
   // CHECK: memref.reshape
   // CHECK: alloc
   // CHECK: linalg.generic
diff --git a/tensorflow/compiler/mlir/tools/kernel_gen/transforms/bufferize_pass.cc b/tensorflow/compiler/mlir/tools/kernel_gen/transforms/bufferize_pass.cc
index 7076bb9..e3c613b 100644
--- a/tensorflow/compiler/mlir/tools/kernel_gen/transforms/bufferize_pass.cc
+++ b/tensorflow/compiler/mlir/tools/kernel_gen/transforms/bufferize_pass.cc
@@ -137,8 +137,6 @@
   }
 
   void runOnOperation() override {
-    RewritePatternSet patterns(&getContext());
-
     // Bufferize ops using BufferizableOpInterface. This could be switched to
     // One-Shot Bufferize in the future.
     bufferization::BufferizationOptions options =
@@ -168,13 +166,7 @@
           return dialect_state;
         });
 
-    bufferization::AlwaysCopyBufferizationState bufferization_state(options);
-    bufferization::populateBufferizationPattern(bufferization_state, patterns);
-
-    GreedyRewriteConfig config;
-    config.useTopDownTraversal = true;
-    if (failed(applyPatternsAndFoldGreedily(getOperation(), std::move(patterns),
-                                            config))) {
+    if (failed(bufferization::bufferizeOp(getOperation(), options))) {
       signalPassFailure();
       return;
     }
@@ -318,7 +310,6 @@
   void runOnOperation() override {
     // Bufferize ops using BufferizableOpInterface. This could be switched to
     // One-Shot Bufferize in the future.
-    RewritePatternSet patterns(&getContext());
     bufferization::BufferizationOptions options =
         bufferization::getPartialBufferizationOptions();
     options.bufferAlignment = alignment_;
@@ -327,11 +318,7 @@
     options.allowDialectInFilter<
         arith::ArithmeticDialect, linalg::LinalgDialect, func::FuncDialect,
         shape::ShapeDialect, tensor::TensorDialect, vector::VectorDialect>();
-    bufferization::AlwaysCopyBufferizationState bufferization_state(options);
-    bufferization::populateBufferizationPattern(bufferization_state, patterns);
-
-    if (failed(applyPatternsAndFoldGreedily(getOperation(),
-                                            std::move(patterns)))) {
+    if (failed(bufferization::bufferizeOp(getOperation(), options))) {
       signalPassFailure();
       return;
     }
diff --git a/tensorflow/compiler/mlir/tosa/transforms/tf_legalize_patterns.td b/tensorflow/compiler/mlir/tosa/transforms/tf_legalize_patterns.td
index ffa989c..cf5f078 100644
--- a/tensorflow/compiler/mlir/tosa/transforms/tf_legalize_patterns.td
+++ b/tensorflow/compiler/mlir/tosa/transforms/tf_legalize_patterns.td
@@ -16,6 +16,7 @@
 // TensorFlow legalization patterns
 
 include "mlir/IR/OpBase.td"
+include "mlir/IR/PatternBase.td"
 include "mlir/Dialect/Func/IR/FuncOps.td"
 include "mlir/Dialect/Tosa/IR/TosaOps.td"
 include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops.td"
diff --git a/tensorflow/compiler/mlir/tosa/transforms/tfl_legalize_patterns.td b/tensorflow/compiler/mlir/tosa/transforms/tfl_legalize_patterns.td
index 37b8de1..3cbbe02 100644
--- a/tensorflow/compiler/mlir/tosa/transforms/tfl_legalize_patterns.td
+++ b/tensorflow/compiler/mlir/tosa/transforms/tfl_legalize_patterns.td
@@ -16,6 +16,7 @@
 // TFLite legalization patterns
 
 include "mlir/IR/OpBase.td"
+include "mlir/IR/PatternBase.td"
 include "mlir/Dialect/Func/IR/FuncOps.td"
 include "tensorflow/compiler/mlir/lite/ir/tfl_ops.td"
 include "mlir/Dialect/Quant/QuantOps.td"
diff --git a/tensorflow/compiler/mlir/xla/ir/xla_framework_ops.td b/tensorflow/compiler/mlir/xla/ir/xla_framework_ops.td
index 9c55446..9356f65 100644
--- a/tensorflow/compiler/mlir/xla/ir/xla_framework_ops.td
+++ b/tensorflow/compiler/mlir/xla/ir/xla_framework_ops.td
@@ -18,6 +18,7 @@
 #ifndef TENSORFLOW_COMPILER_MLIR_XLA_XLA_FRAMEWORK_OPS_TD_
 #define TENSORFLOW_COMPILER_MLIR_XLA_XLA_FRAMEWORK_OPS_TD_
 
+include "mlir/IR/AttrTypeBase.td"
 include "mlir/IR/OpBase.td"
 
 def XLAFramework_Dialect : Dialect {
diff --git a/tensorflow/compiler/mlir/xla/transforms/legalize_tf_collective_patterns.td b/tensorflow/compiler/mlir/xla/transforms/legalize_tf_collective_patterns.td
index 612af7b..c671419 100644
--- a/tensorflow/compiler/mlir/xla/transforms/legalize_tf_collective_patterns.td
+++ b/tensorflow/compiler/mlir/xla/transforms/legalize_tf_collective_patterns.td
@@ -16,6 +16,7 @@
 // This is a legalization pattern definition file for TF to XLA (Collective Ops).
 
 include "mlir/IR/OpBase.td"
+include "mlir/IR/PatternBase.td"
 include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops.td"
 
 def RewriteCollectiveAssignGroupV2CollectiveReduceV2 :
diff --git a/tensorflow/core/ir/types/attributes.td b/tensorflow/core/ir/types/attributes.td
index 92c964b..009bd58 100644
--- a/tensorflow/core/ir/types/attributes.td
+++ b/tensorflow/core/ir/types/attributes.td
@@ -16,6 +16,7 @@
 #ifndef TF_TYPE_ATTRIBUTES
 #define TF_TYPE_ATTRIBUTES
 
+include "mlir/IR/AttrTypeBase.td"
 include "mlir/IR/SubElementInterfaces.td"
 include "tensorflow/core/ir/types/dialect.td"
 
@@ -59,6 +60,7 @@
       return $_get($_ctxt, SymbolRefAttr::get($_ctxt, name), attr);
     }]>
   ];
+  let hasCustomAssemblyFormat = 1;
 }
 
 //===----------------------------------------------------------------------===//
@@ -76,6 +78,7 @@
   let parameters = (ins
     StringRefParameter<"value">:$value
   );
+  let hasCustomAssemblyFormat = 1;
 }
 
 def TFGraph_TypeOrPlaceholder
@@ -129,6 +132,7 @@
     // Returns the shape array if ranked, or None if unranked.
     llvm::Optional<ArrayRef<int64_t>> getValue() const;
   }];
+  let hasCustomAssemblyFormat = 1;
 }
 
 // An array of TF shapes.
@@ -149,6 +153,7 @@
     "int32_t":$minConsumer,
     ArrayRefParameter<"int32_t">:$badConsumers
   );
+  let hasCustomAssemblyFormat = 1;
 }
 
 #endif
diff --git a/tensorflow/core/ir/types/types.td b/tensorflow/core/ir/types/types.td
index ec856c3..0f9e9c6 100644
--- a/tensorflow/core/ir/types/types.td
+++ b/tensorflow/core/ir/types/types.td
@@ -16,9 +16,9 @@
 #ifndef TF_TYPES_TYPES
 #define TF_TYPES_TYPES
 
+include "mlir/IR/AttrTypeBase.td"
 include "tensorflow/core/ir/types/dialect.td"
 
-
 // All of the types will extend this class.
 class TFType_Type<string name> : TypeDef<TFTypeDialect, name> { }
 
diff --git a/third_party/llvm/workspace.bzl b/third_party/llvm/workspace.bzl
index 87c4c87..b79d25e 100644
--- a/third_party/llvm/workspace.bzl
+++ b/third_party/llvm/workspace.bzl
@@ -4,8 +4,8 @@
 
 def repo(name):
     """Imports LLVM."""
-    LLVM_COMMIT = "4767e267757fa56d40248b759d7b17ac1c6fb2ef"
-    LLVM_SHA256 = "0b7c365d75d2271e5350e2179c4d3d876c11e969b3d74c2e1aec213500bba51c"
+    LLVM_COMMIT = "e9c9ee9fe694067ee96643d05d6ac378349386bb"
+    LLVM_SHA256 = "778ada4ceb8eb6ae8f19249b48adf5f788521af734cae5fdb3c72135c7cda2ab"
 
     tf_http_archive(
         name = name,