[all-commits] [llvm/llvm-project] b5149f: [LTO] Fix assertion failed when flushing bitcode i...

Enna1 via All-commits all-commits at lists.llvm.org
Tue Jan 4 21:40:37 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b5149f4e66a49a98b67e8e2de4e24a4af8e2781b
      https://github.com/llvm/llvm-project/commit/b5149f4e66a49a98b67e8e2de4e24a4af8e2781b
  Author: Xu Mingjie <xumingjie.enna1 at bytedance.com>
  Date:   2022-01-04 (Tue, 04 Jan 2022)

  Changed paths:
    M lld/test/ELF/lto/emit-llvm.ll
    M llvm/include/llvm/Support/raw_ostream.h
    M llvm/lib/Support/raw_ostream.cpp

  Log Message:
  -----------
  [LTO] Fix assertion failed when flushing bitcode incrementally for LTO output.

In https://reviews.llvm.org/D86905, we introduce an optimization, when lld emits LLVM bitcode,
we allow bitcode writer flush data to disk early when buffered data size is above some threshold.

But when `--plugin-opt=emit-llvm` and `-o /dev/null` are used,
lld will trigger assertion `BytesRead >= 0 && static_cast<size_t>(BytesRead) == BytesFromDisk`.
When we write output to /dev/null, BytesRead is zero, but at this program point BytesFromDisk is always non-zero.

Reviewed By: stephan.yichao.zhao, MaskRay

Differential Revision: https://reviews.llvm.org/D112297




More information about the All-commits mailing list