OSDN Git Service

PR26055: Speed up LiveDebugValues::transferDebugValue()
authorAdrian Prantl <aprantl@apple.com>
Thu, 26 May 2016 21:42:47 +0000 (21:42 +0000)
committerAdrian Prantl <aprantl@apple.com>
Thu, 26 May 2016 21:42:47 +0000 (21:42 +0000)
commit514970f03eb6844c7fe341f8852aa1edf5dd6d83
treefaad7d8526cf166a620da414e02c4d0f3d5fce12
parent1c5d1efdb3e8bfd088026e6bc893a6387306a80e
PR26055: Speed up LiveDebugValues::transferDebugValue()

This patch builds upon r270776 and speeds up
LiveDebugValues::transferDebugValue() by adding an index that maps each
DebugVariable to its open VarLoc.

The transferDebugValue() function needs to close all open ranges for a
given DebugVariable. Iterating over the set bits of OpenRanges is
prohibitively slow in practice. I experimented with using the sorted map
of VarLocs in the UniqueVector to iterate only over the range of VarLocs
with a given DebugVariable, but the binary search turned out to be even
more expensive than just iterating over the set bits in OpenRanges.
Instead, this patch exploits the fact that there can only be one open
location for each DebugVariable and redundantly stores this location in a
DenseMap.

This patch brings the time spent in the LiveDebugValues pass down to an
almost neglectiable amount.

http://llvm.org/bugs/show_bug.cgi?id=26055
http://reviews.llvm.org/D20636
rdar://problem/24091200

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270923 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/LiveDebugValues.cpp