def loop_lifting(func_ir, typingctx, targetctx, flags, locals):
 blocks = func_ir.blocks.copy()
 cfg = compute_cfg_from_blocks(blocks)
 loopinfos = _loop_lift_get_candidate_infos(cfg, blocks, func_ir.variable_lifetime.livemap)
 loops = []
 for loopinfo in loopinfos:
  lifted = _loop_lift_modify_blocks(func_ir, loopinfo, blocks, typingctx, targetctx, flags, locals)
  loops.append(lifted)
 main = func_ir.derive(blocks=blocks)
 return (main, loops)

def loop_lifting ( func_ir , typingctx , targetctx , flags , locals ) : blocks = func_ir . blocks . copy ( ) cfg = compute_cfg_from_blocks ( blocks ) loopinfos = _loop_lift_get_candidate_infos ( cfg , blocks , func_ir . variable_lifetime . livemap ) loops = [ ] for loopinfo in loopinfos : lifted = _loop_lift_modify_blocks ( func_ir , loopinfo , blocks , typingctx , targetctx , flags , locals ) loops . append ( lifted ) main = func_ir . derive ( blocks = blocks ) return ( main , loops )
loop lifting transformation .