[llvm] [DebugInfo] Drop stale entry value-limitation for call site values (PR #172340)
David Stenberg via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 16 01:51:34 PST 2025
https://github.com/dstenb updated https://github.com/llvm/llvm-project/pull/172340
>From 294de788719fa73e5a5d8459f15cbcc8079946c6 Mon Sep 17 00:00:00 2001
From: David Stenberg <david.stenberg at ericsson.com>
Date: Fri, 5 Dec 2025 15:46:22 +0100
Subject: [PATCH 1/2] [DebugInfo] Drop stale entry value-limitation for call
site values
Entry value operations could previously not be combined with other
operations in debug expressions, meaning that we had to skip emitting
call site values in such cases. This DIExpression limitation was removed
in 57a371d7010802804343d17b85ac5e0d28d0f309, so we should be free to
emit call site values for such cases now, for example:
extern void call(int, int);
void entry_value (int param) {
call(param + 222, param - 444);
}
This change exposed a call site parameter entry order issue in the
dbgcall-site-expr-entry-value.mir test case. That ordering issue is
tracked in #43998, and I don't think there is anything inherent in this
patch that caused that.
---
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 5 -----
.../MIR/AArch64/dbgcall-site-expr-entry-value.mir | 13 ++++++++-----
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 08444fc680df6..a5a84eaf81be6 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -614,11 +614,6 @@ static void finishCallSiteParams(ValT Val, const DIExpression *Expr,
for (auto Param : DescribedParams) {
bool ShouldCombineExpressions = Expr && Param.Expr->getNumElements() > 0;
- // TODO: Entry value operations can currently not be combined with any
- // other expressions, so we can't emit call site entries in those cases.
- if (ShouldCombineExpressions && Expr->isEntryValue())
- continue;
-
// If a parameter's call site value is produced by a chain of
// instructions we may have already created an expression for the
// parameter when walking through the instructions. Append that to the
diff --git a/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-expr-entry-value.mir b/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-expr-entry-value.mir
index d7740e0e59db1..7cff4486cf30f 100644
--- a/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-expr-entry-value.mir
+++ b/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-expr-entry-value.mir
@@ -81,12 +81,15 @@ body: |
...
-# Verify that a call site parameter is emitted for the third parameter. There
-# should also be entries for the first and second parameter, but
-# DW_OP_LLVM_entry_value operations can currently not be emitted together with
-# any other expressions. Verify that nothing is emitted rather than an assert
-# being triggered, or broken expressions being emitted.
+# Verify that call site parameters are emitted for the three parameters.
+# FIXME: The parameters are ordered incorrectly (#43998).
+# CHECK: DW_TAG_GNU_call_site_parameter
+# CHECK-NEXT: DW_AT_location (DW_OP_reg0 W0)
+# CHECK-NEXT: DW_AT_GNU_call_site_value (DW_OP_GNU_entry_value(DW_OP_reg0 W0), DW_OP_plus_uconst 0xde)
# CHECK: DW_TAG_GNU_call_site_parameter
# CHECK-NEXT: DW_AT_location (DW_OP_reg2 W2)
# CHECK-NEXT: DW_AT_GNU_call_site_value (DW_OP_GNU_entry_value(DW_OP_reg0 W0))
+# CHECK: DW_TAG_GNU_call_site_parameter
+# CHECK-NEXT: DW_AT_location (DW_OP_reg1 W1)
+# CHECK-NEXT: DW_AT_GNU_call_site_value (DW_OP_GNU_entry_value(DW_OP_reg0 W0), DW_OP_constu 0x1bc, DW_OP_minus)
>From 76c903450ceb5614e370f05e39b46e0c7f02bc95 Mon Sep 17 00:00:00 2001
From: David Stenberg <david.stenberg at ericsson.com>
Date: Tue, 16 Dec 2025 10:51:12 +0100
Subject: [PATCH 2/2] Fix broken test cases
---
.../DebugInfo/MIR/AArch64/dbgcall-site-interpretation.mir | 4 ++++
llvm/test/DebugInfo/MIR/ARM/dbgcall-site-interpretation.mir | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpretation.mir b/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpretation.mir
index 9df0044d39711..c4a1280865cec 100644
--- a/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpretation.mir
+++ b/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpretation.mir
@@ -20,6 +20,10 @@
# CHECK-NEXT: DW_TAG_GNU_call_site_parameter
# CHECK-NEXT: DW_AT_location (DW_OP_reg1 W1)
# CHECK-NEXT: DW_AT_GNU_call_site_value (DW_OP_breg19 W19-4)
+# CHECK-EMPTY:
+# CHECK-NEXT: DW_TAG_GNU_call_site_parameter
+# CHECK-NEXT: DW_AT_location (DW_OP_reg0 W0)
+# CHECK-NEXT: DW_AT_GNU_call_site_value (DW_OP_GNU_entry_value(DW_OP_reg0 W0), DW_OP_plus_uconst 0x2)
# CHECK: DW_TAG_GNU_call_site
# CHECK-NEXT: DW_AT_abstract_origin {{.*}} "func2")
# CHECK-NEXT: DW_AT_low_pc
diff --git a/llvm/test/DebugInfo/MIR/ARM/dbgcall-site-interpretation.mir b/llvm/test/DebugInfo/MIR/ARM/dbgcall-site-interpretation.mir
index ce9fc094fa297..c3da8c82ac6db 100644
--- a/llvm/test/DebugInfo/MIR/ARM/dbgcall-site-interpretation.mir
+++ b/llvm/test/DebugInfo/MIR/ARM/dbgcall-site-interpretation.mir
@@ -20,6 +20,10 @@
# CHECK-NEXT: DW_TAG_GNU_call_site_parameter
# CHECK-NEXT: DW_AT_location (DW_OP_reg1 R1)
# CHECK-NEXT: DW_AT_GNU_call_site_value (DW_OP_breg4 R4-4)
+# CHECK-EMPTY:
+# CHECK-NEXT: DW_TAG_GNU_call_site_parameter
+# CHECK-NEXT: DW_AT_location (DW_OP_reg0 R0)
+# CHECK-NEXT: DW_AT_GNU_call_site_value (DW_OP_GNU_entry_value(DW_OP_reg0 R0), DW_OP_plus_uconst 0x2)
# CHECK: DW_TAG_GNU_call_site
# CHECK-NEXT: DW_AT_abstract_origin {{.*}}"func2")
# CHECK-NEXT: DW_AT_low_pc
More information about the llvm-commits
mailing list