def dead_code_elimination(graph, du, ud):
 for node in graph.rpo:
  for (i, ins) in node.get_loc_with_ins()[:]:
   reg = ins.get_lhs()
   if (reg is not None):
    if ((reg, i) not in du):
     if ins.is_call():
      ins.remove_defined_var()
     elif ins.has_side_effect():
      continue
     else:
      update_chain(graph, i, du, ud)
      graph.remove_ins(i)

def dead_code_elimination ( graph , du , ud ) : for node in graph . rpo : for ( i , ins ) in node . get_loc_with_ins ( ) [ : ] : reg = ins . get_lhs ( ) if ( reg is not None ) : if ( ( reg , i ) not in du ) : if ins . is_call ( ) : ins . remove_defined_var ( ) elif ins . has_side_effect ( ) : continue else : update_chain ( graph , i , du , ud ) graph . remove_ins ( i )
run a dead code elimination pass .