This patch is meant to resolve task T47541.
Some exporters generate split geometries to preserve sharp edges. Since Blender supports custom normals, it would be nice if we had a mesh tool to "unsplit" the geometry, while maintaining proper shading. This patch implements this feature by slightly modifying the existing weld_verts bmesh operator. This patch also implements an object-mode modifier called "Unsplit Vertices" that invokes this bmesh operator.
The weld_verts bmesh operator is modified to mark edges as sharp edges that are discovered to be duplicates after merging split vertices. The idea is that if an edge is duplicated after merging duplicate vertices, then from a user perspective, the edge was originally doubled for the sake of having a sharp edge. Once these edges are marked as sharp, the idea is that existing custom normals infrastructure can properly compute good normals for the mesh.
To see these changes in action, consider the .blend file from T47540, which is also attached here. If you apply the "Unsplit Vertices" modifier to the left (better looking) object, observe the reduction in the vertex count, with minimal visible change to the mesh.