There is - but given the size of the design space that's mostly done with a library of gates - synthesis/layout pick cells from that library and place them, often putting connected gates together - you could then merge gates in some smart way to save a few percent in area but chances are you wouldn't gain much because you'd have to shuffle all the other gates in that row a bit, and that would mess with timing elsewhere.
Also routing (wires between gates) constrains how close many gates can be, and for everything but regular arrays of gates there may be little point