original_docstring: Strip Phi nodes from ``func_ir``
  
          For each phi node, put incoming value to their respective incoming
          basic-block at possibly the latest position (i.e. after the latest
          assignment to the corresponding variable).
          
docstring: Strip Phi nodes from ``func_ir``
  For each phi node, put incoming value to their respective incoming
  basic-block at possibly the latest position .
docstring_tokens: Strip Phi nodes from ` ` func_ir ` ` For each phi node put incoming value to their respective incoming basic - block at possibly the latest position .
code: def _strip_phi_nodes(self, func_ir):
          """Strip Phi nodes from ``func_ir``
  
          For each phi node, put incoming value to their respective incoming
          basic-block at possibly the latest position (i.e. after the latest
          assignment to the corresponding variable).
          """
          exporters = defaultdict(list)
          phis = set()
          # Find all variables that needs to be exported
          for label, block in func_ir.blocks.items():
              for assign in block.find_insts(ir.Assign):
                  if isinstance(assign.value, ir.Expr):
                      if assign.value.op == 'phi':
                          phis.add(assign)
                          phi = assign.value
                          for ib, iv in zip(phi.incoming_blocks,
                                            phi.incoming_values):
                              exporters[ib].append((assign.target, iv))
  
          # Rewrite the blocks with the new exporting assignments
          newblocks = {}
          for label, block in func_ir.blocks.items():
              newblk = copy(block)
              newblocks[label] = newblk
  
              # strip phis
              newblk.body = [stmt for stmt in block.body if stmt not in phis]
  
              # insert exporters
              for target, rhs in exporters[label]:
                  # If RHS is undefined
                  if rhs is ir.UNDEFINED:
                      # Put in a NULL initializer, set the location to be in what
                      # will eventually materialize as the prologue.
                      rhs = ir.Expr.null(loc=func_ir.loc)
  
                  assign = ir.Assign(
                      target=target,
                      value=rhs,
                      loc=rhs.loc
                  )
                  # Insert at the earliest possible location; i.e. after the
                  # last assignment to rhs
                  assignments = [stmt for stmt in newblk.find_insts(ir.Assign)
                                 if stmt.target == rhs]
                  if assignments:
                      last_assignment = assignments[-1]
                      newblk.insert_after(assign, last_assignment)
                  else:
                      newblk.prepend(assign)
  
          func_ir.blocks = newblocks
          return func_ir
code_tokens: def _strip_phi_nodes ( self , func_ir ) : exporters = defaultdict ( list ) phis = set ( ) for label , block in func_ir . blocks . items ( ) : for assign in block . find_insts ( ir . Assign ) : if isinstance ( assign . value , ir . Expr ) : if assign . value . op == 'phi' : phis . add ( assign ) phi = assign . value for ib , iv in zip ( phi . incoming_blocks , phi . incoming_values ) : exporters [ ib ] . append ( ( assign . target , iv ) ) newblocks = { } for label , block in func_ir . blocks . items ( ) : newblk = copy ( block ) newblocks [ label ] = newblk newblk . body = [ stmt for stmt in block . body if stmt not in phis ] for target , rhs in exporters [ label ] : if rhs is ir . UNDEFINED : rhs = ir . Expr . null ( loc = func_ir . loc ) assign = ir . Assign ( target = target , value = rhs , loc = rhs . loc ) assignments = [ stmt for stmt in newblk . find_insts ( ir . Assign ) if stmt . target == rhs ] if assignments : last_assignment = assignments [ - 1 ] newblk . insert_after ( assign , last_assignment ) else : newblk . prepend ( assign ) func_ir . blocks = newblocks return func_ir
short_docstring: Strip Phi nodes from ``func_ir``
  For each phi node, put incoming value to their respective incoming
  basic-block at possibly the latest position (i.e.
short_docstring_tokens: Strip Phi nodes from ` ` func_ir ` ` For each phi node put incoming value to their respective incoming basic - block at possibly the latest position ( i . e .
comment: """Strip Phi nodes from ``func_ir``
  
          For each phi node, put incoming value to their respective incoming
          basic-block at possibly the latest position (i.e. after the latest
          assignment to the corresponding variable).
          """$SEP$# Find all variables that needs to be exported$SEP$# Rewrite the blocks with the new exporting assignments$SEP$# strip phis$SEP$# insert exporters$SEP$# If RHS is undefined$SEP$# Put in a NULL initializer, set the location to be in what$SEP$# will eventually materialize as the prologue.$SEP$# Insert at the earliest possible location; i.e. after the$SEP$# last assignment to rhs