message: Tweak passes: fuse lstms & inline & dce before lower tensor list ops.
diff: @@ -79,6 +79,23 @@ void AddTFToTFLConversionPasses(const mlir::TFL::PassConfig& pass_config,
  pass_config.quant_specs.serialized_quant_stats));
  }
  + // Note:
  + // We need to fuse composite ops before LowerStaticTensorList pass.
  + // The tensorflow list is not supported right now by that pass.
  + // Enable fusing composite ops that can be lowered to built-in TFLite ops.
  + if (pass_config.emit_builtin_tflite_ops) {
  + pass_manager->addPass(mlir::TFL::CreatePrepareCompositeFunctionsPass());
  + }
  +
  + // This pass marks non-exported functions as symbol visibility 'private'
  + // those deemed read-only as immutable.
  + pass_manager->addPass(
  + mlir::tf_saved_model::
  + CreateMarkFunctionVisibilityUsingSavedModelLinkagePass());
  +
  + pass_manager->addPass(mlir::createInlinerPass());
  + pass_manager->addPass(mlir::createSymbolDCEPass());
  +
  if (pass_config.lower_tensor_list_ops) {
  // TODO(haoliang): Add this pass by default.
  pass_manager->addPass(mlir::TFL::CreateLowerStaticTensorListPass());
  @@ -109,16 +126,6 @@ void AddTFToTFLConversionPasses(const mlir::TFL::PassConfig& pass_config,
  // those deemed read-only as immutable.
  pass_manager->addPass(
  mlir::tf_saved_model::CreateOptimizeGlobalTensorsPass());
  - // This pass marks non-exported functions as symbol visibility 'private'
  - // those deemed read-only as immutable.
  - pass_manager->addPass(
  - mlir::tf_saved_model::
  - CreateMarkFunctionVisibilityUsingSavedModelLinkagePass());
  -
  - // Enable fusing composite ops that can be lowered to built-in TFLite ops.
  - if (pass_config.emit_builtin_tflite_ops) {
  - pass_manager->addPass(mlir::TFL::CreatePrepareCompositeFunctionsPass());
  - }
  // Legalize while early to allow further constant folding.
  // TODO(jpienaar): This may not actually matter as we do canonicalization
  