def finalise_same_chip_constraints(substitutions, placements):
    """Given a set of placements containing the supplied
    :py:class:`MergedVertex`, remove the merged vertices replacing them with
    their constituent vertices (changing the placements inplace).
    """
    for merged_vertex in reversed(substitutions):
        placement = placements.pop(merged_vertex)
        for v in merged_vertex.vertices:
            placements[v] = placement