Skip to content

Conversation

@dstenb
Copy link
Collaborator

@dstenb dstenb commented Dec 15, 2025

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 57a371d, 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.

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 57a371d, 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 llvm#43998, and I don't think there is anything inherent in this
patch that caused that.
@llvmbot
Copy link
Member

llvmbot commented Dec 15, 2025

@llvm/pr-subscribers-debuginfo

Author: David Stenberg (dstenb)

Changes

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 57a371d, 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.


Full diff: https://github.com/llvm/llvm-project/pull/172340.diff

2 Files Affected:

  • (modified) llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (-5)
  • (modified) llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-expr-entry-value.mir (+8-5)
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)

@dstenb
Copy link
Collaborator Author

dstenb commented Dec 15, 2025

I had missed that this affects test cases that #172339 affects as well. I'll address those failures.

@github-actions
Copy link

🐧 Linux x64 Test Results

  • 167170 tests passed
  • 2952 tests skipped
  • 2 tests failed

Failed Tests

(click on a test name to see its output)

LLVM

LLVM.DebugInfo/MIR/AArch64/dbgcall-site-interpretation.mir
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -emit-call-site-info -mtriple aarch64-linux-gnu -debug-entry-values -start-after=machineverifier -filetype=obj /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpretation.mir -o -| /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llvm-dwarfdump -| /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpretation.mir
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -emit-call-site-info -mtriple aarch64-linux-gnu -debug-entry-values -start-after=machineverifier -filetype=obj /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpretation.mir -o -
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llvm-dwarfdump -
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpretation.mir
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpretation.mir:24:15: error: CHECK-NEXT: is not on the line after the previous match
# | # CHECK-NEXT: DW_AT_abstract_origin {{.*}} "func2")
# |               ^
# | <stdin>:86:2: note: 'next' match was here
# |  DW_AT_abstract_origin (0x000000bd "func2")
# |  ^
# | <stdin>:79:33: note: previous match ended here
# | 0x00000098: DW_TAG_GNU_call_site_parameter
# |                                 ^
# | <stdin>:80:1: note: non-matching line after previous match is here
# |  DW_AT_location (DW_OP_reg0 W0)
# | ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpretation.mir
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |          .
# |          .
# |          .
# |         81:  DW_AT_GNU_call_site_value (DW_OP_GNU_entry_value(DW_OP_reg0 W0), DW_OP_plus_uconst 0x2) 
# |         82:  
# |         83: 0x000000a1: NULL 
# |         84:  
# |         85: 0x000000a2: DW_TAG_GNU_call_site 
# |         86:  DW_AT_abstract_origin (0x000000bd "func2") 
# | next:24      !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
# |         87:  DW_AT_low_pc (0x000000000000003c) 
# |         88:  
# |         89: 0x000000af: DW_TAG_GNU_call_site_parameter 
# |         90:  DW_AT_location (DW_OP_reg0 W0) 
# |         91:  DW_AT_GNU_call_site_value (DW_OP_lit13) 
# |          .
# |          .
# |          .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

LLVM.DebugInfo/MIR/ARM/dbgcall-site-interpretation.mir
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -emit-call-site-info -mtriple=arm-linux-gnueabi -debug-entry-values -filetype=obj -start-after=machineverifier /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/DebugInfo/MIR/ARM/dbgcall-site-interpretation.mir -o -| /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llvm-dwarfdump -| /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/DebugInfo/MIR/ARM/dbgcall-site-interpretation.mir
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -emit-call-site-info -mtriple=arm-linux-gnueabi -debug-entry-values -filetype=obj -start-after=machineverifier /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/DebugInfo/MIR/ARM/dbgcall-site-interpretation.mir -o -
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llvm-dwarfdump -
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/DebugInfo/MIR/ARM/dbgcall-site-interpretation.mir
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/DebugInfo/MIR/ARM/dbgcall-site-interpretation.mir:24:15: error: CHECK-NEXT: is not on the line after the previous match
# | # CHECK-NEXT: DW_AT_abstract_origin {{.*}}"func2")
# |               ^
# | <stdin>:86:2: note: 'next' match was here
# |  DW_AT_abstract_origin (0x000000a7 "func2")
# |  ^
# | <stdin>:79:33: note: previous match ended here
# | 0x0000008c: DW_TAG_GNU_call_site_parameter
# |                                 ^
# | <stdin>:80:1: note: non-matching line after previous match is here
# |  DW_AT_location (DW_OP_reg0 R0)
# | ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/DebugInfo/MIR/ARM/dbgcall-site-interpretation.mir
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |          .
# |          .
# |          .
# |         81:  DW_AT_GNU_call_site_value (DW_OP_GNU_entry_value(DW_OP_reg0 R0), DW_OP_plus_uconst 0x2) 
# |         82:  
# |         83: 0x00000095: NULL 
# |         84:  
# |         85: 0x00000096: DW_TAG_GNU_call_site 
# |         86:  DW_AT_abstract_origin (0x000000a7 "func2") 
# | next:24      !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
# |         87:  DW_AT_low_pc (0x00000040) 
# |         88:  
# |         89: 0x0000009f: DW_TAG_GNU_call_site_parameter 
# |         90:  DW_AT_location (DW_OP_reg1 R1) 
# |         91:  DW_AT_GNU_call_site_value (DW_OP_breg4 R4+8) 
# |          .
# |          .
# |          .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the infrastructure label.

@github-actions
Copy link

🪟 Windows x64 Test Results

  • 128657 tests passed
  • 2819 tests skipped
  • 2 tests failed

Failed Tests

(click on a test name to see its output)

LLVM

LLVM.DebugInfo/MIR/AArch64/dbgcall-site-interpretation.mir
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
c:\_work\llvm-project\llvm-project\build\bin\llc.exe -emit-call-site-info -mtriple aarch64-linux-gnu -debug-entry-values -start-after=machineverifier -filetype=obj C:\_work\llvm-project\llvm-project\llvm\test\DebugInfo\MIR\AArch64\dbgcall-site-interpretation.mir -o -| c:\_work\llvm-project\llvm-project\build\bin\llvm-dwarfdump.exe -| c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\DebugInfo\MIR\AArch64\dbgcall-site-interpretation.mir
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -emit-call-site-info -mtriple aarch64-linux-gnu -debug-entry-values -start-after=machineverifier -filetype=obj 'C:\_work\llvm-project\llvm-project\llvm\test\DebugInfo\MIR\AArch64\dbgcall-site-interpretation.mir' -o -
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llvm-dwarfdump.exe' -
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\DebugInfo\MIR\AArch64\dbgcall-site-interpretation.mir'
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\llvm\test\DebugInfo\MIR\AArch64\dbgcall-site-interpretation.mir:24:15: error: CHECK-NEXT: is not on the line after the previous match
# | # CHECK-NEXT: DW_AT_abstract_origin {{.*}} "func2")
# |               ^
# | <stdin>:86:2: note: 'next' match was here
# |  DW_AT_abstract_origin (0x000000bd "func2")
# |  ^
# | <stdin>:79:33: note: previous match ended here
# | 0x00000098: DW_TAG_GNU_call_site_parameter
# |                                 ^
# | <stdin>:80:1: note: non-matching line after previous match is here
# |  DW_AT_location (DW_OP_reg0 W0)
# | ^
# | 
# | Input file: <stdin>
# | Check file: C:\_work\llvm-project\llvm-project\llvm\test\DebugInfo\MIR\AArch64\dbgcall-site-interpretation.mir
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |          .
# |          .
# |          .
# |         81:  DW_AT_GNU_call_site_value (DW_OP_GNU_entry_value(DW_OP_reg0 W0), DW_OP_plus_uconst 0x2) 
# |         82:  
# |         83: 0x000000a1: NULL 
# |         84:  
# |         85: 0x000000a2: DW_TAG_GNU_call_site 
# |         86:  DW_AT_abstract_origin (0x000000bd "func2") 
# | next:24      !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
# |         87:  DW_AT_low_pc (0x000000000000003c) 
# |         88:  
# |         89: 0x000000af: DW_TAG_GNU_call_site_parameter 
# |         90:  DW_AT_location (DW_OP_reg0 W0) 
# |         91:  DW_AT_GNU_call_site_value (DW_OP_lit13) 
# |          .
# |          .
# |          .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

LLVM.DebugInfo/MIR/ARM/dbgcall-site-interpretation.mir
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
c:\_work\llvm-project\llvm-project\build\bin\llc.exe -emit-call-site-info -mtriple=arm-linux-gnueabi -debug-entry-values -filetype=obj -start-after=machineverifier C:\_work\llvm-project\llvm-project\llvm\test\DebugInfo\MIR\ARM\dbgcall-site-interpretation.mir -o -| c:\_work\llvm-project\llvm-project\build\bin\llvm-dwarfdump.exe -| c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\DebugInfo\MIR\ARM\dbgcall-site-interpretation.mir
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -emit-call-site-info -mtriple=arm-linux-gnueabi -debug-entry-values -filetype=obj -start-after=machineverifier 'C:\_work\llvm-project\llvm-project\llvm\test\DebugInfo\MIR\ARM\dbgcall-site-interpretation.mir' -o -
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llvm-dwarfdump.exe' -
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\DebugInfo\MIR\ARM\dbgcall-site-interpretation.mir'
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\llvm\test\DebugInfo\MIR\ARM\dbgcall-site-interpretation.mir:24:15: error: CHECK-NEXT: is not on the line after the previous match
# | # CHECK-NEXT: DW_AT_abstract_origin {{.*}}"func2")
# |               ^
# | <stdin>:86:2: note: 'next' match was here
# |  DW_AT_abstract_origin (0x000000a7 "func2")
# |  ^
# | <stdin>:79:33: note: previous match ended here
# | 0x0000008c: DW_TAG_GNU_call_site_parameter
# |                                 ^
# | <stdin>:80:1: note: non-matching line after previous match is here
# |  DW_AT_location (DW_OP_reg0 R0)
# | ^
# | 
# | Input file: <stdin>
# | Check file: C:\_work\llvm-project\llvm-project\llvm\test\DebugInfo\MIR\ARM\dbgcall-site-interpretation.mir
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |          .
# |          .
# |          .
# |         81:  DW_AT_GNU_call_site_value (DW_OP_GNU_entry_value(DW_OP_reg0 R0), DW_OP_plus_uconst 0x2) 
# |         82:  
# |         83: 0x00000095: NULL 
# |         84:  
# |         85: 0x00000096: DW_TAG_GNU_call_site 
# |         86:  DW_AT_abstract_origin (0x000000a7 "func2") 
# | next:24      !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  error: match on wrong line
# |         87:  DW_AT_low_pc (0x00000040) 
# |         88:  
# |         89: 0x0000009f: DW_TAG_GNU_call_site_parameter 
# |         90:  DW_AT_location (DW_OP_reg1 R1) 
# |         91:  DW_AT_GNU_call_site_value (DW_OP_breg4 R4+8) 
# |          .
# |          .
# |          .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the infrastructure label.

Copy link
Contributor

@OCHyams OCHyams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable, LGTM

Copy link
Collaborator

@djtodoro djtodoro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants