[all-commits] [llvm/llvm-project] 6af859: [DebugInfo] Re-implement LexicalScopes dominance m...

Jeremy Morse via All-commits all-commits at lists.llvm.org
Fri Feb 28 03:45:32 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 6af859dcca272cf3706d070183562e4cecb1dc36
      https://github.com/llvm/llvm-project/commit/6af859dcca272cf3706d070183562e4cecb1dc36
  Author: Jeremy Morse <jeremy.morse at sony.com>
  Date:   2020-02-28 (Fri, 28 Feb 2020)

  Changed paths:
    M llvm/lib/CodeGen/LexicalScopes.cpp
    M llvm/unittests/CodeGen/CMakeLists.txt
    A llvm/unittests/CodeGen/LexicalScopesTest.cpp
    A llvm/unittests/CodeGen/MFCommon.inc
    M llvm/unittests/CodeGen/MachineInstrTest.cpp

  Log Message:
  -----------
  [DebugInfo] Re-implement LexicalScopes dominance method, add unit tests

Way back in D24994, the combination of LexicalScopes::dominates and
LiveDebugValues was identified as having worst-case quadratic complexity,
but it wasn't triggered by any code path at the time. I've since run into a
scenario where this occurs, in a very large basic block where large numbers
of inlined DBG_VALUEs are present.

The quadratic-ness comes from LiveDebugValues::join calling "dominates" on
every variable location, and LexicalScopes::dominates potentially touching
every instruction in a block to test for the presence of a scope. We have,
however, already computed the presence of scopes in blocks, in the
"InstrRanges" of each scope. This patch switches the dominates method to
examine whether a block is present in a scope's InsnRanges, avoiding
walking through the whole block.

At the same time, fix getMachineBasicBlocks to account for the fact that
InsnRanges can cover multiple blocks, and add some unit tests, as Lexical
Scopes didn't have any.

Differential revision: https://reviews.llvm.org/D73725




More information about the All-commits mailing list