Optical second harmonic generation (SHG) is known as a sensitive probe to the crystalline symmetry of few-layer transition metal dichalcogenides (TMDs). Layer-number dependent and polarization resolved SHG have been observed for the special case of Bernal stacked few-layer TMDs, but it remains largely unexplored for structures deviated from this ideal stacking order. Here we report on the SHG from homo- and heterostructural TMD bilayers formed by artificial stacking with an arbitrary stacking angle. The SHG from the twisted bilayers is a coherent superposition of the SH fields from the individual layers, with a phase difference depending on the stacking angle. Such an interference effect is insensitive to the constituent layered materials and thus applicable to hetero-stacked bilayers. A proof-of-concept demonstration of using the SHG to probe the domain boundary and crystal polarity of mirror twins formed in chemically grown TMDs is also presented. We show here that the SHG is an efficient, sensitive, and nondestructive characterization for the stacking orientation, crystal polarity, and domain boundary of van der Waals heterostructures made of noncentrosymmetric layered materials.