class_docstr: Encapsulation of the basic CFG state changes needed for lowering.
class_docstr_tok: ["Encapsulation","of","the","basic","CFG","state","changes","needed","for","lowering","."]
docstr: May change the last block's terminator instruction to a return.
  
  If the terminator meant "exit this control flow graph", change it
  to "return from this function".
  
  Raises:
    ValueError: If the terminator was a `BranchOp` that directly
      exited, because there is no "conditional indirect goto"
      instruction in the target IR.
docstr_tok: ["May","change","the","last","block","'s","terminator","instruction","to","a","return",".","If","the","terminator","meant","``","exit","this","control","flow","graph","''",",","change","it","to","``","return","from","this","function","''",".","Raises",":","ValueError",":","If","the","terminator","was","a","`","BranchOp","`","that","directly","exited",",","because","there","is","no","``","conditional","indirect","goto","''","instruction","in","the","target","IR","."]
code: def maybe_adjust_terminator(self):
      """May change the last block's terminator instruction to a return.
  
      If the terminator meant "exit this control flow graph", change it
      to "return from this function".
  
      Raises:
        ValueError: If the terminator was a `BranchOp` that directly
          exited, because there is no "conditional indirect goto"
          instruction in the target IR.
      """
      op = self.cur_block().terminator
      if inst.is_return_op(op):
          self.cur_block().terminator = inst.IndirectGotoOp()
      if isinstance(op, inst.BranchOp) and (
          op.true_block is None or op.false_block is None
      ):
          # Why not?  Because there is no "conditional indirect goto"
          # instruction in the target IR.  One solution is to
          # canonicalize away directly exiting branches, by replacing
          # them with a branch to a fresh empty block that just exits.
          raise ValueError(
              "Cannot lower exiting BranchOp {}.".format(op)
          )
  
imports: import collections
  from tensorflow_probability.python.experimental.auto_batching import instructions
  from tensorflow_probability.python.experimental.auto_batching import liveness
label_desc: Use image node_id 8 for calling the ControlFlowGraphBuilder obj's underlying member method code with example usage: obj.maybe_adjust_terminator() without return types