Analogy between shear flow stratification and compressibility effects in hydrodynamic stability theory