message: Improve the performance of HloVerifier via reusing a visitor
diff: @@ -13,6 +13,8 @@ See the License for the specific language governing permissions and
  limitations under the License.
  ==============================================================================*/
  +#include "tensorflow/compiler/xla/service/hlo_verifier.h"
  +
  #include <set>
  #include "absl/container/flat_hash_map.h"
  @@ -21,7 +23,6 @@ limitations under the License.
  #include "tensorflow/compiler/xla/service/hlo_instruction.h"
  #include "tensorflow/compiler/xla/service/hlo_instructions.h"
  #include "tensorflow/compiler/xla/service/hlo_opcode.h"
  -#include "tensorflow/compiler/xla/service/hlo_verifier.h"
  #include "tensorflow/compiler/xla/status_macros.h"
  #include "tensorflow/compiler/xla/util.h"
  #include "tensorflow/core/lib/core/errors.h"
  @@ -1486,11 +1487,9 @@ StatusOr<bool> HloVerifier::Run(HloModule* module) {
  std::unique_ptr<ShapeVerifier> shape_verifier =
  target_metadata_->GetVerifier();
  + InstructionVerifier instruction_verifier(instruction_can_change_layout_func_);
  for (auto* computation : module->computations()) {
  TF_RETURN_IF_ERROR(computation->Accept(shape_verifier.get()));
  -
  - InstructionVerifier instruction_verifier(
  - instruction_can_change_layout_func_);
  TF_RETURN_IF_ERROR(computation->Accept(&instruction_verifier));
  }
  