U.S. stocks erased earlier losses on Tuesday as the major indexes tried to recover from a recent steep sell-off.