[all-commits] [llvm/llvm-project] ce6de3: [DebugInfo] Drop location ranges for variables whi...

Orlando Cazalet-Hyams via All-commits all-commits at lists.llvm.org
Wed Jul 22 05:11:35 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: ce6de3747bce66b122134d02bb6d25827730d498
      https://github.com/llvm/llvm-project/commit/ce6de3747bce66b122134d02bb6d25827730d498
  Author: OCHyams <orlando.hyams at sony.com>
  Date:   2020-07-22 (Wed, 22 Jul 2020)

  Changed paths:
    M llvm/include/llvm/CodeGen/DbgEntityHistoryCalculator.h
    M llvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
    M llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
    M llvm/test/DebugInfo/ARM/PR26163.ll
    M llvm/test/DebugInfo/COFF/register-variables.ll
    M llvm/test/DebugInfo/X86/live-debug-variables.ll
    A llvm/test/DebugInfo/X86/trim-var-locs.mir

  Log Message:
  -----------
  [DebugInfo] Drop location ranges for variables which exist entirely outside the variable's scope

Summary:
This patch reduces file size in debug builds by dropping variable locations a
debugger user will not see.

After building the debug entity history map we loop through it. For each
variable we look at each entry. If the entry opens a location range which does
not intersect any of the variable's scope's ranges then we mark it for removal.
After visiting the entries for each variable we also mark any clobbering
entries which will no longer be referenced for removal, and then finally erase
the marked entries. This all requires the ability to query the order of
instructions, so before this runs we number them.

Tests:
Added llvm/test/DebugInfo/X86/trim-var-locs.mir

Modified llvm/test/DebugInfo/COFF/register-variables.ll
  Branch folding merges the tails of if.then and if.else into if.else. Each
  blocks' debug-locations point to different scopes so when they're merged we
  can't use either. Because of this the variable 'c' ends up with a location
  range which doesn't cover any instructions in its scope; with the patch
  applied the location range is dropped and its flag changes to IsOptimizedOut.

Modified llvm/test/DebugInfo/X86/live-debug-variables.ll
Modified llvm/test/DebugInfo/ARM/PR26163.ll
  In both tests an out of scope location is now removed. The remaining location
  covers the entire scope of the variable allowing us to emit it as a single
  location.

Reviewed By: aprantl

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




More information about the All-commits mailing list