[PATCH] D142654: [LiveDebugValues] Allow EntryValue with OP_deref expressions
Felipe de Azevedo Piovezan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 26 10:55:29 PST 2023
fdeazeve created this revision.
fdeazeve added reviewers: aprantl, Orlando, jmorse, vsk.
Herald added a subscriber: hiraditya.
Herald added a project: All.
fdeazeve requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
With D68945 <https://reviews.llvm.org/D68945>, more DBG_VALUEs were created without the indirect operand,
instead relying on OP_deref to accomplish the same effect.
At the time, however, we were not able to handle arbitrary expressions
in combination with OP_LLVM_entry_value, so D71416 <https://reviews.llvm.org/D71416> prevented the use of
such operation in the presence of expressions.
As per the comment in DIExpression::isValid, "we support only entry
values of a simple register location." As such, a simple deref operation
should be supported. In fact, D80345 <https://reviews.llvm.org/D80345> added support for indirect
DBG_VALUEs.
Taken the patches above into consideration, this commit relaxes the
restrictions on which expressions are allowed for entry value
candidates: the expression must be either empty or a single dereference
operator.
This patch is useful for D141381 <https://reviews.llvm.org/D141381>, which adds support for storing the
address of ABI-indirect parameters on the stack.
Depends on D142160 <https://reviews.llvm.org/D142160>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D142654
Files:
llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp
llvm/test/DebugInfo/MIR/X86/dbgcall-site-reference.mir
Index: llvm/test/DebugInfo/MIR/X86/dbgcall-site-reference.mir
===================================================================
--- llvm/test/DebugInfo/MIR/X86/dbgcall-site-reference.mir
+++ llvm/test/DebugInfo/MIR/X86/dbgcall-site-reference.mir
@@ -7,11 +7,7 @@
# struct D : C { D(B); };
# D::D(B b) : C(b) {}
-# Reproducer for PR44275. Ideally we should get an entry value location list
-# entry for the reference parameter b, but we are currently not able to do that
-# due to limitations in the DWARF emission code, which puts restrictions on the
-# DIExpression. For now verify that we don't crash when trying to add such an
-# entry value.
+# Reproducer for PR44275.
# CHECK: DW_AT_location
# CHECK-NEXT: [{{0x[0-9a-f]+}}, {{0x[0-9a-f]+}}): DW_OP_reg5 RDI
@@ -19,8 +15,8 @@
# CHECK-NEXT: DW_AT_name ("this")
# CHECK: DW_AT_location
-# CHECK-NEXT: [0x0000000000000000, 0x0000000000000004): DW_OP_breg4 RSI+0)
-# TODO: Here we should ideally get a location list entry using an entry value.
+# CHECK-NEXT: [0x0000000000000000, 0x0000000000000004): DW_OP_breg4 RSI+0
+# CHECK-NEXT: [0x0000000000000004, 0x000000000000000b): DW_OP_GNU_entry_value(DW_OP_reg4 RSI))
# CHECK-NEXT: DW_AT_name ("b")
--- |
Index: llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp
===================================================================
--- llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp
+++ llvm/lib/CodeGen/LiveDebugValues/VarLocBasedImpl.cpp
@@ -2151,10 +2151,9 @@
// TODO: Add support for parameters that have a pre-existing debug expressions
// (e.g. fragments).
- if (MI.getDebugExpression()->getNumElements() > 0)
- return false;
-
- return true;
+ // A simple deref expression is equivalent to an indirect debug value.
+ const DIExpression *DIExpr = MI.getDebugExpression();
+ return DIExpr->isDeref() || DIExpr->getNumElements() == 0;
}
/// Collect all register defines (including aliases) for the given instruction.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142654.492519.patch
Type: text/x-patch
Size: 1969 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230126/20deebbb/attachment.bin>
More information about the llvm-commits
mailing list