[DebugInfo] Limit the size of DIExpressions that we will salvage up to
authorStephen Tozer <stephen.tozer@sony.com>
Tue, 21 Sep 2021 14:11:22 +0000 (15:11 +0100)
committerStephen Tozer <stephen.tozer@sony.com>
Fri, 15 Oct 2021 16:34:21 +0000 (17:34 +0100)
commitf5ed223b0fd0d45ff18013e38756546210e03a34
tree95d3169a56b2d6d7823c7ddc7184f8d87c35ad3e
parentb24788abd8df02169ecbf6afa91836819c8a35fe
[DebugInfo] Limit the size of DIExpressions that we will salvage up to

Fixes: https://bugs.llvm.org/show_bug.cgi?id=51841

This patch places an arbitrary limit on the size of DIExpressions that
we will produce via salvaging, for performance reasons. This helps to
fix a performance issue observed in the bug above, in which debug values
would be salvaged hundreds of times, producing expressions with over
1000 elements and causing the compiler to hang. Limiting the size of
debug values that we will produce to 128 largely fixes this issue.

Reviewed By: dblaikie, jmorse

Differential Revision: https://reviews.llvm.org/D110332
llvm/lib/Transforms/Utils/Local.cpp
llvm/test/DebugInfo/salvage-limit-expr-size.ll [new file with mode: 0644]