[tosa] [mlir] tfl.IfOp isn’t supported in tf-mlir-translate.
[proposed Label] comp:lite-tosa, seems I don't have the access to config the labels.

 Hi @Jerry-Ge,

Yes, currently it is true that `tf.IfOp -> tfl.IfOp` only happens at export time. Would you mind sharing the tflite model in question as well as how it was generated? Thanks @LukeBoyer, I pushed the dummy model I used for testing here: https://github.com/Jerry-Ge/tfl_models/tree/main

It's generated by using the `tf.cond()` operator and the `tf.lite.TFLiteConverter.from_concrete_functions` 

Then you ran the flatbuffer_translate code provided from above, you will get the `test_tflite.preopt.mlir` output I got. 

Let me know if you need more details. 



 Thanks @Jerry-Ge. We are prioritizing fixing this issue and having the if op be legalized appropriately. I think 1-2 weeks is when the fix will come. > 

Hi Luke, any updates here? Tks  Hi @Jerry-Ge, we're still working on this. It's taking longer than expected since a lot of tests expect `tf.If` and the op is not entirely equivalent to `tfl.If` so it's not a trivial find/replace change. We also have internal downstream dependents which will need to be updated.

Can you help provide additional detail and context about your need for this? Just trying to understand if it's a nuisance, blocker, or something in between. Thanks! Thanks for the update! Don't worry and I can wait : ) Hi @arfaian, any updates on this issue? If it's done, then we can close it?  If nobody plans to fix this, I will close this ticket by the end of this week.  Nobody is responding to this issue. Close this ticket for now. 
**System information**
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 20.04.5 LTS  
- TensorFlow installed from (source or binary): source
- TensorFlow version (or github SHA if from source): 45f08a0fcc90145b9c2b7057310762d6b0ebae85

**Standalone code to reproduce the issue** 
```
tensorflow/bazel-bin/tensorflow/compiler/mlir/lite/flatbuffer_translate --tflite-flatbuffer-to-mlir onlyif/test_onlyif_1_f32/model.tflite --output-arrays=PartitionedCall:0 -o onlyif/test_onlyif_1_f32/test_tflite.preopt.mlir
```

test_tflite.preopt.mlir output: 
```
  func.func @main(%arg0: tensor<1xf32> {tf_saved_model.index_path = ["placeholder_0"]}) -> (tensor<*xf32> {tf_saved_model.index_path = ["output_0"]}) attributes {tf.entry_function = {inputs = "serving_default_placeholder_0:0", outputs = "PartitionedCall:0"}, tf_saved_model.exported_names = ["serving_default"]} {
    %0 = "tfl.pseudo_const"() {value = dense<5.000000e+00> : tensor<f32>} : () -> tensor<f32>
    %1 = tfl.less(%arg0, %0) : (tensor<1xf32>, tensor<f32>) -> tensor<1xi1>
    %2 = "tfl.pseudo_const"() {value = dense<> : tensor<0xi32>} : () -> tensor<0xi32>
    %3 = "tfl.reshape"(%1, %2) : (tensor<1xi1>, tensor<0xi32>) -> tensor<i1>
    // !!!!! THIS IS NOT tfl.If !!!!!!
    %4 = "tf.If"(%3, %arg0, %0) {else_branch = @cond_false_70, is_stateless = false, then_branch = @cond_true_60} : (tensor<i1>, tensor<1xf32>, tensor<f32>) -> tensor<*xf32>
    return %4 : tensor<*xf32>
  }
```


**Any other info / logs**
- The goal is to generate tfl.IfOp in MLIR
- seems a lot of TF::IfOp is used everywhere and a TFL::IfOp is only instantiated during the flatbuffer export
- Some TODOs here: 
    - https://github.com/tensorflow/tensorflow/blob/ba8b52cad65f882bed982517a7b7cf60c598efab/tensorflow/compiler/mlir/lite/flatbuffer_export.cc#L572
    - https://github.com/tensorflow/tensorflow/blob/524101303ff158b939923b36805474f2e4118a49/tensorflow/compiler/mlir/lite/transforms/pin_ops_with_side_effects.cc#L48




Could anyone update the progress of the support of this operator? 
