def _merge(program, context):
    """
    Merge a context that was generated with the given program.
    """
    merged = set()
    for inst in reversed(program.insts):
        if inst.target in merged:
            continue
        else:
            merged.add(inst.target)
            if inst.ty is not None:
                if inst.ty.mutable:
                    context[inst.target] = inst.ty.combine(context[inst.target]
                        )
                else:
                    context[inst.target] = None
