aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/Local.cpp
diff options
context:
space:
mode:
authorShubham Sandeep Rastogi <srastogi22@apple.com>2024-05-29 16:25:02 -0700
committerGitHub <noreply@github.com>2024-05-29 16:25:02 -0700
commitf4681be06b465736cc993b114dd8e2625d37b779 (patch)
treed110e6f4bbacee48c5178c85d8e43bb2d46ca065 /llvm/lib/Transforms/Utils/Local.cpp
parent69969c725b0987a12a27a8ac787f06be672a4d09 (diff)
downloadllvm-f4681be06b465736cc993b114dd8e2625d37b779.zip
llvm-f4681be06b465736cc993b114dd8e2625d37b779.tar.gz
llvm-f4681be06b465736cc993b114dd8e2625d37b779.tar.bz2
Use DIExpression::foldConstantMath at the result of a Salvaged expression (#71721)
This patch uses `DIExpression::foldConstantMath()` at the result of a Salvaged expression, that is, it runs the folding optimizations after an expression has been salvaged completely, to reduce how many times the fold optimization function is called. Which should help in reducing the size of DIExpressions that grow because of salvaging debug info After checking the size of the dSYM with and without this change, I saw a decrease of about 300KB, where the debug_loc section is about 1.6 GB in size. Where the debug loc section reduced in size by 212KB and it is 193MB in size, the rest comes from the debug_info section This is part of a stack of patches and comes after: https://github.com/llvm/llvm-project/pull/69768 https://github.com/llvm/llvm-project/pull/71717 https://github.com/llvm/llvm-project/pull/71718 https://github.com/llvm/llvm-project/pull/71719
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/Local.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index f3cd310..ce0f4c7 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -2230,6 +2230,8 @@ template <typename T> static void salvageDbgAssignAddress(T *Assign) {
assert(!SalvagedExpr->getFragmentInfo().has_value() &&
"address-expression shouldn't have fragment info");
+ SalvagedExpr = SalvagedExpr->foldConstantMath();
+
// Salvage succeeds if no additional values are required.
if (AdditionalValues.empty()) {
Assign->setAddress(NewV);
@@ -2290,6 +2292,7 @@ void llvm::salvageDebugInfoForDbgValues(
if (!Op0)
break;
+ SalvagedExpr = SalvagedExpr->foldConstantMath();
DII->replaceVariableLocationOp(&I, Op0);
bool IsValidSalvageExpr = SalvagedExpr->getNumElements() <= MaxExpressionSize;
if (AdditionalValues.empty() && IsValidSalvageExpr) {
@@ -2351,6 +2354,7 @@ void llvm::salvageDebugInfoForDbgValues(
if (!Op0)
break;
+ SalvagedExpr = SalvagedExpr->foldConstantMath();
DVR->replaceVariableLocationOp(&I, Op0);
bool IsValidSalvageExpr =
SalvagedExpr->getNumElements() <= MaxExpressionSize;