[all-commits] [llvm/llvm-project] 3fab2d: [DebugInfo][InstrRef] Add a max-stack-slots-to-tra...
Jeremy Morse via All-commits
all-commits at lists.llvm.org
Tue Feb 1 11:25:50 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 3fab2d138e30c65249e1eaea6cc68b2b7f50955a
https://github.com/llvm/llvm-project/commit/3fab2d138e30c65249e1eaea6cc68b2b7f50955a
Author: Jeremy Morse <jeremy.morse at sony.com>
Date: 2022-02-01 (Tue, 01 Feb 2022)
Changed paths:
M llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
M llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
A llvm/test/DebugInfo/MIR/InstrRef/spill-slot-limits.mir
M llvm/unittests/CodeGen/InstrRefLDVTest.cpp
Log Message:
-----------
[DebugInfo][InstrRef] Add a max-stack-slots-to-track cut-out
In certain circumstances with things like autogenerated code and asan, you
can end up with thousands of Values live at the same time, causing a large
working set and a lot of information spilled to the stack. Unfortunately
InstrRefBasedLDV doesn't cope well with this and consumes a lot of memory
when there are many many stack slots. See the reproducer in D116821.
It seems very unlikely that a developer would be able to reason about
hundreds of live named local variables at the same time, so a huge working
set and many stack slots is an indicator that we're likely analysing
autogenerated or instrumented code. In those cases: gracefully degrade by
setting an upper bound on the amount of stack slots to track. This limits
peak memory consumption, at the cost of dropping some variable locations,
but in a rare scenario where it's unlikely someone is actually going to
use them.
In terms of the patch, this adds a cl::opt for max number of stack slots to
track, and has the stack-slot-numbering code optionally return None. That
then filters through a number of code paths, which can then chose to not
track a spill / restore if it touches an untracked spill slot. The added
test checks that we drop variable locations that are on the stack, if we
set the limit to zero.
Differential Revision: https://reviews.llvm.org/D118601
More information about the All-commits
mailing list