[PATCH] D112297: [LTO] Fix assertion failed when flushing bitcode incrementally for LTO output.
stephan.yichao.zhao via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 28 08:44:54 PDT 2021
stephan.yichao.zhao added a comment.
Thank you for testing this.
The test cases fail because the code seeks <https://github.com/llvm/llvm-project/blob/main/llvm/lib/Support/raw_ostream.cpp#L820> on /dev/null. Somehow /dev/null can be seeked to the current position, but not others, while BitcodeWriter fails because it seeks /dev/null to non-current position.
BitcodeWriter relies on raw_fd_stream. If the creation of raw_fd_stream returns an error, BitcodeWriter will gets only raw_fd_ostream. raw_fd_stream uses supportsSeek <https://github.com/llvm/llvm-project/blob/main/llvm/lib/Support/raw_ostream.cpp#L918> to check if returning an error.
raw_fd_stream was introduced <https://github.com/llvm/llvm-project/commit/0ece51c60c51f0d4c285dbda3b6cff794041bdd7> for BitcodeWriter to support that optimization. So I am suggesting we put your original change here <https://github.com/llvm/llvm-project/blob/main/llvm/lib/Support/raw_ostream.cpp#L918> like this
sys::fs::file_status Status;
std::error_code EC = status(get_fd(), Status);
if (EC || Status.type() != sys::fs::file_type::regular_file)
EC = std::make_error_code(std::errc::invalid_argument);
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112297/new/
https://reviews.llvm.org/D112297
More information about the llvm-commits
mailing list