[PATCH] D88405: [LiveDebugValues][InstrRef][1/2] Try harder to recover clobbered variable locations
Jeremy Morse via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 28 05:00:44 PDT 2020
jmorse created this revision.
jmorse added a reviewer: debug-info.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
jmorse requested review of this revision.
Hi,
Here's a patch that improves variable location PC-range coverage when using the instruction-referencing LiveDebugValues implementation. I've mostly been focusing on ensuring there are no regressions in variable availability (i.e., the number of variables that have at least one location), and wasn't really looking at the 'PC Ranges covered' output of llvm-locstats. This patch rectifies some of that to give a modest improvement in covered PC ranges -- however the real benefits come with entry values (see next patch, an additional 5% PC ranges).
In various circumstances, when we clobber a register there may be alternative locations that the value is live in. The classic example would be a value loaded from the stack, and then clobbered: the value is still available on the stack. InstrRefBasedLDV was coping with this at block starts where it's forced to pick a location; however it wasn't searching for alternative locations when values were clobbered. This patch notifies the "TransferTracker" object when clobbers occur, and it's able to find alternatives and issue DBG_VALUEs for the that location. See: the added test.
More generally, it's pretty clear that this should be done by something like DbgEntityHistoryCalculator instead, which would also be able to avoid redundant location transfers. But that's an improvement for another day.
Here's the output of llvm-locstats when buildling clang-3.4 before and after this patch, when forcing the use of InstrRefBasedLV, for which I've added an -mllvm switch.
Before:
=================================================
cov% samples percentage(~)
-------------------------------------------------
0% 872495 26%
(0%,10%) 47486 1%
[10%,20%) 50330 1%
[20%,30%) 57127 1%
[30%,40%) 48881 1%
[40%,50%) 46630 1%
[50%,60%) 59643 1%
[60%,70%) 57581 1%
[70%,80%) 67858 2%
[80%,90%) 77362 2%
[90%,100%) 100012 2%
100% 1866414 55%
=================================================
-the number of debug variables processed: 3351819
-PC ranges covered: 56%
-------------------------------------------------
-total availability: 60%
=================================================
After:
=================================================
cov% samples percentage(~)
-------------------------------------------------
0% 872508 26%
(0%,10%) 44994 1%
[10%,20%) 49960 1%
[20%,30%) 56512 1%
[30%,40%) 48070 1%
[40%,50%) 46135 1%
[50%,60%) 58738 1%
[60%,70%) 55552 1%
[70%,80%) 65360 1%
[80%,90%) 74530 2%
[90%,100%) 97362 2%
100% 1882113 56%
=================================================
-the number of debug variables processed: 3351834
-PC ranges covered: 56%
-------------------------------------------------
-total availability: 60%
=================================================
So that's roughly 16,000 more variable locations in the 100% bucket, and other variable locations have shifted up a few buckets too.
This patch isn't based on any of the other instruction referencing work, only the LiveDebugValues implementation in tree. After a few months of prodding it, it could definitely do with a refactor, but I'd like to do that from a position where it's working well. Given that it's "officially" in an experimental state, it's not clear if it needs "full" review, I'll probably take my lead from the child patch that I'll upload in a moment.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D88405
Files:
llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp
llvm/test/DebugInfo/MIR/InstrRef/livedebugvalues_recover_clobbers.mir
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88405.294660.patch
Type: text/x-patch
Size: 10279 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200928/0e04aeca/attachment.bin>
More information about the llvm-commits
mailing list