[PATCH] D68816: [NFC] Replace a linked list in LiveDebugVariables pass with a DenseMap
Orlando Cazalet-Hyams via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 10 10:13:37 PDT 2019
Orlando created this revision.
Orlando added reviewers: aprantl, probinson, vsk, dblaikie.
Orlando added a project: debug-info.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
Orlando added a comment.
The numbers are much better than I expected but I haven't been able to prove
myself wrong after a bunch of testing. So, I've put this patch up for the
community's expert eyes.
Before going into details of the patch, I think it's important to point out
that it seems to reduces self-host build times of llvm on my Linux VM
by up to 12%:
------------------------------------------------------------------
Self-host build times with and without this patch
------------------------------------------------------------------
With this patch applied | Build type | CPU time (mins)
------------------------------------------------------------------
No | RelWithDebInfo, asan | 226
Yes | RelWithDebInfo, asan | 218 (-3.5%)
No | RelWithDebInfo | 183
Yes | RelWithDebInfo | 161 (-12%)
In LiveDebugValues.cpp:
Prior to this patch, UserValues were grouped into linked list chains. Each
chain was the union of two sets: { A: Matching Source variable } or
{ B: Matching virtual register }. A ptr to the heads (or 'leaders')
of each of these chains were kept in a map with the { Source variable } used
as the key (set A predicate) and another with { Virtual register } as key
(set B predicate).
There was a search through the chains in the function getUserValue looking for
UserValues with matching { Source variable, Complex expression, Inlined-at
location }. Essentially searching for a subset of A through two interleaved
linked lists of set A and B. Importantly, by design, the subset will only
contain one or zero elements here. That is to say a UserValue can be uniquely
identified by the tuple { Source variable, Complex expression, Inlined-at
location } if it exists.
This patch removes the linked list and instead uses a DenseMap to map
the tuple { Source variable, Complex expression, Inlined-at location }
to UserValue ptrs so that the getUserValue search predicate is this map key.
The virtual register map now maps a vreg to a SmallVector<UserVal *> so that
set B is still available for quick searches.
Repository:
rL LLVM
https://reviews.llvm.org/D68816
Files:
llvm/lib/CodeGen/LiveDebugVariables.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68816.224396.patch
Type: text/x-patch
Size: 9760 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191010/a4daa547/attachment-0001.bin>
More information about the llvm-commits
mailing list