def remove_build_list_swap_pattern(self, entries):
        """ Find the following bytecode pattern:

            BUILD_{LIST, MAP, SET}
            SWAP(2)
            FOR_ITER
            ...
            END_FOR
            SWAP(2)

            This pattern indicates that a list/dict/set comprehension has
            been inlined. In this case we can skip the exception blocks
            entirely along with the dead exceptions that it points to.
            A pair of exception that sandwiches these exception will
            also be merged into a single exception.

            Update for Python 3.13, the ending of the pattern has a extra
            POP_TOP:

            ...
            END_FOR
            POP_TOP
            SWAP(2)

            Update for Python 3.13.1, there's now a GET_ITER before FOR_ITER.
            This patch the GET_ITER to NOP to minimize changes downstream
            (e.g. array-comprehension).
        """
        def pop_and_merge_exceptions(entries: list,
                                     entry_to_remove: _ExceptionTableEntry):
            lower_entry_idx = entries.index(entry_to_remove) - 1
            upper_entry_idx = entries.index(entry_to_remove) + 1

            # Merge the upper and lower exceptions if possible.
            if lower_entry_idx >= 0 and upper_entry_idx < len(entries):
                lower_entry = entries[lower_entry_idx]
                upper_entry = entries[upper_entry_idx]
                if lower_entry.target == upper_entry.target:
                    entries[lower_entry_idx] = _ExceptionTableEntry(
                        lower_entry.start,
                        upper_entry.end,
                        lower_entry.target,
                        lower_entry.depth,
                        upper_entry.lasti)
                    entries.remove(upper_entry)

            # Remove the exception entry.
            entries.remove(entry_to_remove)
            # Remove dead exceptions, if any, that the entry above may point to.
            entries = [e for e in entries
                       if not e.start == entry_to_remove.target]
            return entries

        change_to_nop = set()
        work_remaining = True
        while work_remaining:
            # Temporarily set work_remaining to False, if we find a pattern
            # then work is not complete, hence we set it again to True.
            work_remaining = False
            current_nop_fixes = set()
            for entry in entries.copy():
                # Check start of pattern, three instructions.
                # Work out the index of the instruction.
                index = self.ordered_offsets.index(entry.start)
                # If there is a BUILD_{LIST, MAP, SET} instruction at this
                # location.
                curr_inst = self.table[self.ordered_offsets[index]]
                if curr_inst.opname not in ("BUILD_LIST",
                                            "BUILD_MAP",
                                            "BUILD_SET"):
                    continue
                # Check if the BUILD_{LIST, MAP, SET} instruction is followed
                # by a SWAP(2).
                next_inst = self.table[self.ordered_offsets[index + 1]]
                if not next_inst.opname == "SWAP" and next_inst.arg == 2:
                    continue
                next_inst = self.table[self.ordered_offsets[index + 2]]
                # Check if the SWAP is followed by a FOR_ITER
                # BUT Python3.13.1 introduced an extra GET_ITER.
                # If we see a GET_ITER here, check if the next thing is a
                # FOR_ITER.
                if next_inst.opname == "GET_ITER":
                    # Add the inst to potentially be replaced to NOP
                    current_nop_fixes.add(next_inst)
                    # Loop up next instruction.
                    next_inst = self.table[self.ordered_offsets[index + 3]]

                if not next_inst.opname == "FOR_ITER":
                    continue

                if PYVERSION in ((3, 13),):
                    # Check end of pattern, two instructions.
                    # Check for the corresponding END_FOR, exception table end
                    # is non-inclusive, so subtract one.
                    index = self.ordered_offsets.index(entry.end)
                    curr_inst = self.table[self.ordered_offsets[index - 2]]
                    if not curr_inst.opname == "END_FOR":
                        continue
                    next_inst = self.table[self.ordered_offsets[index - 1]]
                    if not next_inst.opname == "POP_TOP":
                        continue
                    # END_FOR must be followed by SWAP(2)
                    next_inst = self.table[self.ordered_offsets[index]]
                    if not next_inst.opname == "SWAP" and next_inst.arg == 2:
                        continue
                elif PYVERSION in ((3, 10), (3, 11), (3, 12)):
                    # Check end of pattern, two instructions.
                    # Check for the corresponding END_FOR, exception table end
                    # is non-inclusive, so subtract one.
                    index = self.ordered_offsets.index(entry.end)
                    curr_inst = self.table[self.ordered_offsets[index - 1]]
                    if not curr_inst.opname == "END_FOR":
                        continue
                    # END_FOR must be followed by SWAP(2)
                    next_inst = self.table[self.ordered_offsets[index]]
                    if not next_inst.opname == "SWAP" and next_inst.arg == 2:
                        continue
                else:
                    raise NotImplementedError(PYVERSION)
                # If all conditions are met that means this exception entry
                # is for a list/dict/set comprehension and can be removed.
                # Also if there exist exception entries above and below this
                # entry pointing to the same target. those can be merged into
                # a single bigger exception block.
                entries = pop_and_merge_exceptions(entries, entry)
                work_remaining = True

                # Commit NOP fixes since we confirmed the suspects belong to
                # a comprehension code.
                change_to_nop |= current_nop_fixes

        # Complete fixes to NOPs
        for inst in change_to_nop:
            self.table[inst.offset] = ByteCodeInst(inst.offset,
                                                   dis.opmap["NOP"],
                                                   None,
                                                   inst.next)
        return entries
 Find the following bytecode pattern:

            BUILD_{LIST, MAP, SET}
            SWAP(2)
            FOR_ITER
            ...
            END_FOR
            SWAP(2)

            This pattern indicates that a list/dict/set comprehension has
            been inlined. In this case we can skip the exception blocks
            entirely along with the dead exceptions that it points to.
            A pair of exception that sandwiches these exception will
            also be merged into a single exception.

            Update for Python 3.13, the ending of the pattern has a extra
            POP_TOP:

            ...
            END_FOR
            POP_TOP
            SWAP(2)

            Update for Python 3.13.1, there's now a GET_ITER before FOR_ITER.
            This patch the GET_ITER to NOP to minimize changes downstream
            (e.g. array-comprehension).
        
numba/core/bytecode.py