We proposed that BaHgSn is a Dirac semimetal (DSM) which can host hourglasslike surface states (HSSs) as protected by nonsymmorphic glide symmetry. Compared to KHgSb, an isostructural topological crystalline insulator with the same HSSs, BaHgSn has an additional band inversion at the Γ point. This band inversion is induced by the stronger interlayer coupling among Hg-Sn honeycomb layers than that among Hg-Sb layers in KHgSb, which leads to bulk Dirac nodes in BaHgSn along the layer stacking direction Γ -A . In addition, the mirror Chern number Ci protected by the mirror plane M¯z (kz=0 ) changes from 2 in KHgSb to 3 in BaHgSn. Therefore, when a compressive uniaxial strain is applied along the y axis to break the rotation symmetry protecting the DSM state, BaHgSn becomes a strong topological insulator with Z2 indices of (1 ;000 ) and the topological surface Dirac cone coexists with HSSs on the (010) surface. The Wilson-loop spectra have been calculated to verify these topological features. The calculated surface states, the Fermi surfaces and their quasiparticle interference patterns are ready to be compared with experimental measurements.