[all-commits] [llvm/llvm-project] 32ab40: [LTO] Emit DebugLoc for dead function in optimizat...

Enna1 via All-commits all-commits at lists.llvm.org
Tue Sep 21 14:50:44 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 32ab405717ecb92041d8f753a1ccd0e5dd874cb7
      https://github.com/llvm/llvm-project/commit/32ab405717ecb92041d8f753a1ccd0e5dd874cb7
  Author: Xu Mingjie <xumingjie.enna1 at bytedance.com>
  Date:   2021-09-21 (Tue, 21 Sep 2021)

  Changed paths:
    M llvm/include/llvm/LTO/LTO.h
    M llvm/lib/LTO/LTO.cpp
    M llvm/test/LTO/Resolution/X86/dead-strip-fulllto.ll

  Log Message:
  -----------
  [LTO] Emit DebugLoc for dead function in optimization remarks

Currently, the dead functions information getting from optimizations remarks does not contain debug location, but knowing where these dead functions locate could be useful for debugging or for detecting dead code.

Cause in `LTO::addRegularLTO()` we use `BitcodeModule::getLazyModule()` to read the bitcode module, when we pass Function F to `ore::NV()`, F is not materialized, so `F->getSubprogram()` returns nullptr, and there is no debug location information of dead functions in optimizations remarks.

This patch call `F->materialize()` before we pass Function F to `ore::NV()`, then debug location information will be emitted for dead functions in optimization remarks.

Reviewed By: tejohnson

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




More information about the All-commits mailing list