Make the computation of the memory budget lower bound more efficient. Specifically:
Make the computation of the memory budget lower bound more efficient. Specifically:
1. Iterate over AliasAnalysis::buffers() rather than the live ranges as the latter has too many duplicates
2. Turn a Shape object into a const reference
3. Pull out a conditional to exit early when possible.

FUTURE_COPYBARA_INTEGRATE_REVIEW=https://github.com/openxla/xla/pull/10344 from Intel-tensorflow:kanvi/bmm+mul+add 9c1fee304a6cfed55c0c869d1930641d942cf93f
