[NFC] Fix performance issue in LiveDebugVariables
authorOCHyams <orlando.hyams@sony.com>
Thu, 2 Apr 2020 07:41:25 +0000 (08:41 +0100)
committerOCHyams <orlando.hyams@sony.com>
Thu, 2 Apr 2020 08:39:33 +0000 (09:39 +0100)
commit550ab58bc106335f8dcbc1767548a55c7151f87a
tree8cdfdd0c2a9798ae4faa458f8d7e48c059b2ef01
parent29d253c4c6879bfe57040c8c59b0d9d84f6e5e2f
[NFC] Fix performance issue in LiveDebugVariables

When compiling AMDGPUDisassembler.cpp in a stage 1 trunk build with
CMAKE_BUILD_TYPE=RelWithDebInfo LLVM_USE_SANITIZER=Address LiveDebugVariables
accounts for 21.5% wall clock time. This fix reduces that to 1.2% by switching
out a linked list lookup with a map lookup.

Note that the linked list is still used to group UserValues by vreg. The vreg
lookups don't cause any problems in this pathological case.

This is the same idea as D68816, which was reverted, except that it is a less
intrusive fix.

Reviewed By: vsk

Differential Revision: https://reviews.llvm.org/D77226
llvm/lib/CodeGen/LiveDebugVariables.cpp