[all-commits] [llvm/llvm-project] b9d977: [DWARF] Add cuttoff guarding quadratic validThroug...

Jeremy Morse via All-commits all-commits at lists.llvm.org
Wed Jul 8 02:31:20 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: b9d977b0ca60c54f11615ca9d144c9f08b29fd85
      https://github.com/llvm/llvm-project/commit/b9d977b0ca60c54f11615ca9d144c9f08b29fd85
  Author: Jeremy Morse <jeremy.morse at sony.com>
  Date:   2020-07-08 (Wed, 08 Jul 2020)

  Changed paths:
    M llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    M llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
    A llvm/test/DebugInfo/MIR/X86/singlelocation-cutoffs.mir

  Log Message:
  -----------
  [DWARF] Add cuttoff guarding quadratic validThroughout behaviour

Occasionally we see absolutely massive basic blocks, typically in global
constructors that are vulnerable to heavy inlining. When these blocks are
dense with DBG_VALUE instructions, we can hit near quadratic complexity in
DwarfDebug's validThroughout function. The problem is caused by:

  * validThroughout having to step through all instructions in the block to
    examine their lexical scope,
  * and a high proportion of instructions in that block being DBG_VALUEs
    for a unique variable fragment,

Leading to us stepping through every instruction in the block, for (nearly)
each instruction in the block.

By adding this guard, we force variables in large blocks to use a location
list rather than a single-location expression, as shown in the added test.
This shouldn't change the meaning of the output DWARF at all: instead we
use a less efficient DWARF encoding to avoid a poor-performance code path.

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




More information about the All-commits mailing list