def get_merge_targest(module):
    """Return a set of basic blocks that are targets of merge instructions."""
    merge_targets = set()
    for function in module.functions:
        for basic_block in function.basic_blocks:
            if (len(basic_block.insts) > 1 and
                    basic_block.insts[-2] in ['OpLoopMerge',
                                              'OpSelectionMerge']):
                target_id = basic_block.inst.operands[0]
                merge_targets.add(target_id.inst.basic_block)
    return merge_targets