diff --git a/tensorflow/compiler/mlir/tensorflow/utils/dump_mlir_util.cc b/tensorflow/compiler/mlir/tensorflow/utils/dump_mlir_util.cc index f06734a26bd..1b8ae8403bf 100644 --- a/tensorflow/compiler/mlir/tensorflow/utils/dump_mlir_util.cc +++ b/tensorflow/compiler/mlir/tensorflow/utils/dump_mlir_util.cc @@ -43,7 +43,8 @@ std::string MakeUniqueFilename(string name) { // Remove illegal characters from `name`. for (int i = 0; i < name.size(); ++i) { char ch = name[i]; - if (ch == '/' || ch == '[' || ch == ']' || ch == '*' || ch == '?') { + if (ch == '/' || ch == '[' || ch == ']' || ch == '*' || ch == '?' || + ch == '\\') { name[i] = '_'; } } @@ -123,10 +124,7 @@ Status CreateFileForDumping(llvm::StringRef name, << "' directory for dumping: " << status; return Status(error::Code::UNAVAILABLE, "(unavailable)"); } - *filepath = llvm::Twine(dir) - .concat("/") - .concat(MakeUniqueFilename(std::string(name))) - .str(); + *filepath = io::JoinPath(dir, MakeUniqueFilename(std::string(name))); // Try to open the file and generate a raw_ostream. std::unique_ptr file;