class_docstr: When a block does not modify a block input var, eliminate that block
  input var and use the corresponding var in the outer scope. Example:
  
  .. code-block::
  
     # Before loop_invariant_elimination pass.
     # Notice that ``%b.x`` is constant through while loop iterates.
     main(%a: (1, 2, fp32),
          %b: (1, 2, fp32)) {
       block0() {
         %loop:0: (1, 2, fp32), %loop:1: (1, 2, fp32) =            while_loop(loop_vars=(%a, %b))
           loop_cond(%a.x, %b.x) {
             %cond_var: (bool) = some_op(x=%a.x, y=%b.x)
           } -> (%cond_var)
           loop_body(%a.x, %b.x) {
             %add_0: (1, 2, fp32) = add(x=%a.x, y=%b.x)
           } -> (%add_0, %b.x)
       } -> (%loop:0, %loop:1)
     }
  
     # After loop_invariant_elimination pass.
     main(%a: (1, 2, fp32),
          %b: (1, 2, fp32)) {
       block0() {
         %loop:1: (1, 2, fp32) = identity(x=%b)
         %loop:0: (1, 2, fp32) =            while_loop(loop_vars=(%a))
           loop_cond(%a.x) {
             %cond_var: (bool) = some_op(x=%a.x, y=%b)
           } -> (%cond_var)
           loop_body(%a.x) {
             %add_0: (1, 2, fp32) = add(x=%a.x, y=%b)
           } -> (%add_0)
       } -> (%loop:0, %loop:1)
     }
  
  where we eliminate loop invariant ``%b.x`` from ``while_loop``, which returns 1
  instead of 2 outputs. We also preserve the return var names with identity.
code: def apply(self, prog):
      for f in prog.functions.values():
          self._loop_invariant_elimination_block(f)
  
file_path: coremltools/coremltools/converters/mil/mil/passes/defs/cleanup/loop_invariant_elimination.py
imports: from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil.passes.graph_pass import AbstractGraphPass
  from coremltools.converters.mil.mil.passes.helper import block_context_manager
  from coremltools.converters.mil.mil.passes.pass_registry import register_pass
label_desc: Use image node_id 1 for calling the loop_invariant_elimination obj's underlying member method code with example usage: obj.apply(prog) without return types