[DebugInfo] Unify location selection logic for values in InstrRefBasedImpl
authorStephen Tozer <Stephen.Tozer@Sony.com>
Tue, 20 Dec 2022 14:52:11 +0000 (14:52 +0000)
committerStephen Tozer <Stephen.Tozer@Sony.com>
Tue, 20 Dec 2022 17:58:05 +0000 (17:58 +0000)
commita685bb8e333e711d7496f59589694c460f981062
tree817c1087938250915588294bce36fb9fc968b860
parent41dd02e8575144e576e9ad111bbdc3f856c58445
[DebugInfo] Unify location selection logic for values in InstrRefBasedImpl

Currently the instruction referencing live debug values has 3 separate
places where we iterate over all known locations to find the best machine
location for a set of values at a given point in the program. Each of these
places has an implementation of this check, and one of them has slightly
different logic to the others. This patch moves the check for the "quality"
of a machine location into a separate function, which also avoids repeatedly
calling expensive functions, giving a slight performance improvement.

Differential Revision: https://reviews.llvm.org/D140412
llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
llvm/test/DebugInfo/MIR/X86/live-debug-values-restore.mir