<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - No inline debug info generated for small functions when optimizing"
   href="https://llvm.org/bugs/show_bug.cgi?id=25630">25630</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>No inline debug info generated for small functions when optimizing
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>dnovillo@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>danielcdh@gmail.com, dblaikie@gmail.com, echristo@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=15349" name="attach_15349" title="Test case">attachment 15349</a> <a href="attachment.cgi?id=15349&action=edit" title="Test case">[details]</a></span>
Test case

For one liner functions, LLVM seems to not be emitting inlined-at information
in the final binary.  The inlinedAt tags are there in the bytecode, but don't
show up in the final binary.

If I change the code of the inlined function to have more than one line, then
the inlinedAt markers survive to the final binary.

$ clang++ -O2 -g bug.cc -o bug
$ llvm-dwarfdump --debug-dump=info bug|grep -A6 DW_TAG_inlined_subroutine

When compiled with GCC, the inlined function is marked properly:

$ g++-4.9 -O2 -g bug.cc -o gcc-bug
$ llvm-dwarfdump --debug-dump=info gcc-bug|grep -A6 DW_TAG_inlined_subroutine
0x00000476:       DW_TAG_inlined_subroutine [21] *
                    DW_AT_abstract_origin [DW_FORM_ref4]        (cu + 0x028d =>
{0x000003da} "_Z3sumxx")
                    DW_AT_low_pc [DW_FORM_addr] (0x0000000000400559)
                    DW_AT_high_pc [DW_FORM_data8]       (0x0000000000000003)
                    DW_AT_call_file [DW_FORM_data1]     ("./bug.cc")
                    DW_AT_call_line [DW_FORM_data1]     (8)
                    DW_AT_GNU_discriminator [DW_FORM_data1]     (0x02)


If I modified the inlined function to have more code, LLVM will generate a
DW_TAG_inlined_subroutine tag.  I did this in the no-bug.cc test case:

$ clang++ -g -O2 no-bug.cc -o no-bug
$ llvm-dwarfdump --debug-dump=info no-bug|grep -A6 DW_TAG_inlined_subroutine
0x000000b1:     DW_TAG_inlined_subroutine [9] *
                  DW_AT_abstract_origin [DW_FORM_ref4]  (cu + 0x004c =>
{0x0000004c} "_Z3sumxx")
                  DW_AT_low_pc [DW_FORM_addr]   (0x000000000040063e)
                  DW_AT_high_pc [DW_FORM_data4] (0x00000010)
                  DW_AT_call_file [DW_FORM_data1]       ("./no-bug.cc")
                  DW_AT_call_line [DW_FORM_data1]       (13)
                  DW_AT_GNU_discriminator [DW_FORM_data1]       (0x01)</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>