[PATCH] D112297: [LTO] Fix assertion failed when flushing bitcode incrementally for LTO output.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 27 16:01:27 PDT 2021


MaskRay added a comment.

Before `openLTOOutputFile` is called, the output may be non-existent.
Then `if (!sys::fs::is_regular_file(file))` will disable the D86905 <https://reviews.llvm.org/D86905> memory optimization.

The D86905 <https://reviews.llvm.org/D86905> memory optimization relies on `read(2)` reading back bytes in the file (for the `BackpatchWord` operation).
However, read(2) on `/dev/null` just returns 0.
So it is right to skip that optimization.

Now I suspect that such an optimization does not belong lld/ELF. Many users may need this including other binary format ports of lld.
So hope @stephan.yichao.zhao can move the subtle code to `BitstreamWriter.h`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112297/new/

https://reviews.llvm.org/D112297



More information about the llvm-commits mailing list