aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/LiveDebugVariables.cpp
diff options
context:
space:
mode:
authorStephen Tozer <Stephen.Tozer@Sony.com>2021-05-07 13:53:09 +0100
committerStephen Tozer <Stephen.Tozer@Sony.com>2021-05-07 14:55:02 +0100
commit7bc1dd1191aba77da83f04415ee646cc3381729e (patch)
tree2c8afd931a1097380245533404a78aeef2ec2f64 /llvm/lib/CodeGen/LiveDebugVariables.cpp
parentc9d4b4173b56c5a56d32d07be660f872b9746f87 (diff)
downloadllvm-7bc1dd1191aba77da83f04415ee646cc3381729e.zip
llvm-7bc1dd1191aba77da83f04415ee646cc3381729e.tar.gz
llvm-7bc1dd1191aba77da83f04415ee646cc3381729e.tar.bz2
Reapply "[DebugInfo] Drop DBG_VALUE_LISTs with an excessive number of debug operands"
Reapply b623df3c, which was reverted while reverting a different patch with a breaking change. There are no underlying issues with this patch, so no changes have been made to the original patch. This reverts commit b11e4c990771541e440861f017afea7b4ba162f4.
Diffstat (limited to 'llvm/lib/CodeGen/LiveDebugVariables.cpp')
-rw-r--r--llvm/lib/CodeGen/LiveDebugVariables.cpp38
1 files changed, 27 insertions, 11 deletions
diff --git a/llvm/lib/CodeGen/LiveDebugVariables.cpp b/llvm/lib/CodeGen/LiveDebugVariables.cpp
index 100dacb..2761ee6 100644
--- a/llvm/lib/CodeGen/LiveDebugVariables.cpp
+++ b/llvm/lib/CodeGen/LiveDebugVariables.cpp
@@ -119,17 +119,33 @@ public:
DIExpression::replaceArg(Expression, OpIdx, DuplicatingIdx);
}
}
- // A debug value referencing 64+ unique machine locations is very likely
- // to be the result of a bug earlier in the pipeline. If by some means this
- // limit is validly reached, then we can add a byte to the size of
- // LocNoCount.
- assert(LocNoVec.size() < 64 &&
- "debug value containing 64+ unique machine locations is not "
- "supported by Live Debug Variables");
- LocNoCount = LocNoVec.size();
- if (LocNoCount > 0) {
- LocNos.reset(new unsigned[LocNoCount]());
- std::copy(LocNoVec.begin(), LocNoVec.end(), loc_nos_begin());
+ // FIXME: Debug values referencing 64+ unique machine locations are rare and
+ // currently unsupported for performance reasons. If we can verify that
+ // performance is acceptable for such debug values, we can increase the
+ // bit-width of LocNoCount to 14 to enable up to 16384 unique machine
+ // locations. We will also need to verify that this does not cause issues
+ // with LiveDebugVariables' use of IntervalMap.
+ if (LocNoVec.size() < 64) {
+ LocNoCount = LocNoVec.size();
+ if (LocNoCount > 0) {
+ LocNos = std::make_unique<unsigned[]>(LocNoCount);
+ std::copy(LocNoVec.begin(), LocNoVec.end(), loc_nos_begin());
+ }
+ } else {
+ LLVM_DEBUG(dbgs() << "Found debug value with 64+ unique machine "
+ "locations, dropping...\n");
+ LocNoCount = 1;
+ // Turn this into an undef debug value list; right now, the simplest form
+ // of this is an expression with one arg, and an undef debug operand.
+ Expression =
+ DIExpression::get(Expr.getContext(), {dwarf::DW_OP_LLVM_arg, 0,
+ dwarf::DW_OP_stack_value});
+ if (auto FragmentInfoOpt = Expr.getFragmentInfo())
+ Expression = *DIExpression::createFragmentExpression(
+ Expression, FragmentInfoOpt->OffsetInBits,
+ FragmentInfoOpt->SizeInBits);
+ LocNos = std::make_unique<unsigned[]>(LocNoCount);
+ LocNos[0] = UndefLocNo;
}
}