Investors are questioning the massive scale of AI spending that has pushed the S&P 500 and Nasdaq to historic highs recently.