def check_and_legalize_ir(func_ir, flags: "numba.core.compiler.Flags"):
    """
    This checks that the IR presented is legal
    """
    enforce_no_phis(func_ir)
    enforce_no_dels(func_ir)
    # postprocess and emit ir.Dels
    post_proc = postproc.PostProcessor(func_ir)
    post_proc.run(True, extend_lifetimes=flags.dbg_extend_lifetimes)

    This checks that the IR presented is legal
    
numba/core/ir_utils.py