message: Indicate after which pass the HloVerifier failed in the
  HLO pipeline. Example emitted error:
  InvalidArgumentError: Expected instruction to have shape compatible with f32[], actual shape is f32[42,1]:
  %divide.1 = f32[42,1]{1,0} divide(f32[] %divide, f32[] %constant)
  Failed after running pass: algebraic-simplifier
diff: @@ -27,6 +27,7 @@ limitations under the License.
  #include "tensorflow/core/platform/logging.h"
  using ::tensorflow::strings::StrAppend;
  +using ::tensorflow::strings::StrCat;
  namespace xla {
  @@ -54,11 +55,18 @@ StatusOr<bool> HloPassPipeline::Run(HloModule* module) {
  << tensorflow::str_util::Join(disabled_passes, ", ");
  }
  - auto run_invariant_checkers = [this, module]() -> Status {
  + auto run_invariant_checkers = [this,
  + module](const string& message) -> Status {
  for (auto& invariant_checker : invariant_checkers_) {
  VLOG(1) << " Invariant checker " << invariant_checker->name();
  - TF_ASSIGN_OR_RETURN(bool changed, invariant_checker->Run(module));
  - TF_RET_CHECK(!changed) << "invariant checkers must not change the graph";
  + StatusOr<bool> changed_status = invariant_checker->Run(module);
  + if (!changed_status.ok()) {
  + return Status(changed_status.status().code(),
  + StrCat(changed_status.status().error_message(),
  + "\n\nFailed ", message));
  + }
  + TF_RET_CHECK(!changed_status.ValueOrDie())
  + << "invariant checkers must not change the graph";
  }
  return Status::OK();
  };
  @@ -66,6 +74,8 @@ StatusOr<bool> HloPassPipeline::Run(HloModule* module) {
  string prefix = name().ToString() + ": pipeline start";
  bool changed = false;
  string message;
  + TF_RETURN_IF_ERROR(
  + run_invariant_checkers(StrCat("before running pipeline: ", name())));
  for (auto& pass : passes_) {
  if (disabled_passes.count(pass->name().ToString()) > 0) {
  VLOG(1) << " Skipping HLO pass " << pass->name()
  @@ -80,14 +90,14 @@ StatusOr<bool> HloPassPipeline::Run(HloModule* module) {
  StrAppend(&message, prefix, ", before ", pass->name());
  DumpModule(*module, message);
  - TF_RETURN_IF_ERROR(run_invariant_checkers());
  TF_ASSIGN_OR_RETURN(bool changed_this_pass, pass->Run(module));
  + TF_RETURN_IF_ERROR(
  + run_invariant_checkers(StrCat("after running pass: ", pass->name())));
  changed |= changed_this_pass;
  prefix.clear();
  StrAppend(&prefix, name(), ": after ", pass->name());
  }
  - TF_RETURN_IF_ERROR(run_invariant_checkers());
  DumpModule(*module, prefix + ", pipeline end");
  return changed;
  }
  