[HloValueSemanticsAnalysis] Deduplicate some functions.
[HloValueSemanticsAnalysis] Deduplicate some functions.

FUTURE_COPYBARA_INTEGRATE_REVIEW=https://github.com/openxla/xla/pull/11122 from ROCm:5.7-rccl-hang 2d196b645ccac046309d44f747d42777f00f1c9b
