[all-commits] [llvm/llvm-project] cb63ad: [LTO] Fix incomplete optimization remarks for dead...

Enna1 via All-commits all-commits at lists.llvm.org
Mon Dec 20 18:16:21 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cb63ad8d1d8c5d4d3b50a616067e1aac9ce1eda8
      https://github.com/llvm/llvm-project/commit/cb63ad8d1d8c5d4d3b50a616067e1aac9ce1eda8
  Author: Xu Mingjie <xumingjie.enna1 at bytedance.com>
  Date:   2021-12-20 (Mon, 20 Dec 2021)

  Changed paths:
    A lld/test/ELF/lto/opt-remarks-incomplete.ll
    M llvm/lib/LTO/LTO.cpp

  Log Message:
  -----------
  [LTO] Fix incomplete optimization remarks for dead functions when PreOptModuleHook or PostInternalizeModuleHook is defined

In 20a895c4be01769a37dfffb3c6b513a7bc9b8d17, we introduce `finalizeOptimizationRemarks()` to make sure we flush the diagnostic remarks file in case the linker doesn't call the global destructors before exiting.
In https://reviews.llvm.org/D73597, we add optimization remarks for removed functions for debugging or for detecting dead code.
But there is a case, if PreOptModuleHook or PostInternalizeModuleHook is defined (e.g. `--plugin-opt=emit-llvm` is passed to linker), we do not call `finalizeOptimizationRemarks()`, therefore we will get an incomplete optimization remarks file.
This patch make sure we flush the diagnostic remarks file when PreOptModuleHook or PostInternalizeModuleHook is defined.

Reviewed By: tejohnson, MaskRay

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




More information about the All-commits mailing list