<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 optimization of code deduplication"
   href="https://bugs.llvm.org/show_bug.cgi?id=36316">36316</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Missed optimization of code deduplication
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </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>LLVM Codegen
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>mafagafogigante@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=19847" name="attach_19847" title="C++, followed by the ASM outputs">attachment 19847</a> <a href="attachment.cgi?id=19847&action=edit" title="C++, followed by the ASM outputs">[details]</a></span>
C++, followed by the ASM outputs

I've included the minimum source code required and the relevant ASM output for
GCC (trunk) and Clang (trunk).

The GCC output does not issue duplicated code for isNice(), which makes its
version relatively shorter. Clang, on the other hand, (I assume) fails to
identify this optimization opportunity.

For convenience, here is a Godbolt link: <a href="https://godbolt.org/g/ijuNMb">https://godbolt.org/g/ijuNMb</a></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>