<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 - Block is missing entry value DBG_VALUE"
   href="https://bugs.llvm.org/show_bug.cgi?id=43373">43373</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Block is missing entry value DBG_VALUE
          </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>Linux
          </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 using r372374.

Compiling the following test case:

  extern void bar(int);
  extern void baz(void);

  int foo(int p) {
    if (p)
      bar(1);
    baz();
    return 0;
  }

using:

  clang -O1 -g -Xclang -femit-debug-entry-values

gives the following disassembled output:

  0000000000000000 foo:
         0: 50                                  pushq   %rax
         1: 85 ff                               testl   %edi, %edi
         3: 74 0a                               je      10 <foo+0xf>
         5: bf 01 00 00 00                      movl    $1, %edi
         a: e8 00 00 00 00                      callq   0 <foo+0xf>
         f: e8 00 00 00 00                      callq   0 <foo+0x14>
        14: 31 c0                               xorl    %eax, %eax
        16: 59                                  popq    %rcx
        17: c3                                  retq

and the following location list for the parameter:

  DW_AT_location        (0x00000000
    [0x0000000000000000,  0x000000000000000a): DW_OP_reg5 RDI
    [0x000000000000000a,  0x000000000000000f): DW_OP_GNU_entry_value(DW_OP_reg5
RDI), DW_OP_stack_value)

As seen, the entry value ends before the second call to foo (at 0xf). As the
parameter is not modified, I'd except entry value locations being present for
the rest of the function.

This is how it looks after LiveDebugValues:

  bb.0.entry:
    successors: %bb.2(0x30000000), %bb.1(0x50000000)
    liveins: $edi

    DBG_VALUE $edi, $noreg, !19, !DIExpression(), debug-location !20
    DBG_VALUE $edi, $noreg, !19, !DIExpression(), debug-location !20
    frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp
    CFI_INSTRUCTION def_cfa_offset 16
    TEST32rr killed renamable $edi, renamable $edi, implicit-def $eflags,
debug-location !21
    JCC_1 %bb.2, 4, implicit $eflags, debug-location !23

  bb.1.if.then:
    successors: %bb.2(0x80000000)

    DBG_VALUE $edi, $noreg, !19, !DIExpression(), debug-location !20
    $edi = MOV32ri 1, debug-location !24
    DBG_VALUE $edi, $noreg, !19, !DIExpression(DW_OP_LLVM_entry_value, 1),
debug-location !20
    CALL64pcrel32 @bar, csr_64, implicit $rsp, implicit $ssp, implicit $edi,
implicit-def $rsp, implicit-def $ssp, debug-location !24

  bb.2.if.end:
    CALL64pcrel32 @baz, csr_64, implicit $rsp, implicit $ssp, implicit-def
$rsp, implicit-def $ssp, debug-location !25
    $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags,
debug-location !26
    $rcx = frame-destroy POP64r implicit-def $rsp, implicit $rsp,
debug-location !26
    CFI_INSTRUCTION def_cfa_offset 8, debug-location !26
    RETQ killed $eax, debug-location !26

It seems that an entry value DBG_VALUE is not propagated to bb.2.if.end?</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>