<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 - Inlined functions are not optimized as well as the same code copied in-line"
   href="https://bugs.llvm.org/show_bug.cgi?id=43033">43033</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Inlined functions are not optimized as well as the same code copied in-line
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>henrik@gramner.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Minimal sample code:

static inline int imin(int a, int b) {
    return a < b ? a : b;
}

int fn1(int a, int b) {
    if (a < b) __builtin_unreachable();
    return imin(a, b);
}

int fn2(int a, int b) {
    if (a < b) __builtin_unreachable();
    return a < b ? a : b;
}


compiled with -O3 produces (Linux x86-64):

fn1:
        mov     eax, esi
        cmp     edi, esi
        cmovle  eax, edi
        ret
fn2:
        mov     eax, esi
        ret

Only in fn2 is the ternary operation correctly optimized away.</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>