Only if the amplitude is relatively small.
SHM is an approximation. But it is a good approximation in most of the cases.