<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Missed opportunity to emit call site parameter entry"
   href="https://bugs.llvm.org/show_bug.cgi?id=44119">44119</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Missed opportunity to emit call site parameter entry
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>DebugInfo
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>david.stenberg@ericsson.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jdevlieghere@apple.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Reproduced on 3889ff82bf4057ead22dad91a89384ac20ebd557.

Compiling the following file:

  extern void callee(int);
  extern int value(void);
  extern int global;

  int caller() {
    if (global) {
      int local = value();
      callee(local);
      return local;
    }
    return 0;
  }

using:

  clang --target=x86_64 -O1 -g -Xclang -femit-debug-entry-values -c missed.c

we do not get a call site parameter entry for callee's parameter:

  llvm-dwarfdump missed.o | grep -c call_site_parameter
  0

This is the code for the call and the parameter value:

  CALL64pcrel32 @value, csr_64, implicit $rsp, implicit $ssp, implicit-def
$rsp, implicit-def $ssp, implicit-def $eax, debug-location !26
  $ebx = MOV32rr $eax, debug-location !26
  DBG_VALUE $ebx, $noreg, !17, !DIExpression(), debug-location !27
  $edi = MOV32rr $eax, debug-location !28
  CALL64pcrel32 @callee, csr_64, implicit $rsp, implicit $ssp, implicit killed
$edi, implicit-def $rsp, implicit-def $ssp, debug-location !28
  JMP_1 %bb.3

The describeLoadedValue() hook will be able to describe that the value of $edi
is available in $eax, but as that is not a preserved register we can't emit a
call site entry using that. The code does not understand that $eax's value is
available in the preserved register $ebx during the call. When looking for call
site values in collectCallSiteParameters(), should we also keep track of other
copy instructions, and then try to find a preserved copy of the register to
instead describe the call site entry with?</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>