International Business Machines Corp beat analysts’ estimates for second-quarter profit on Wednesday, propped up by recurring growth in its high-margin cloud business.