<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 --- - Code is not optimized with -O2 when used with variadic arguments"
   href="https://llvm.org/bugs/show_bug.cgi?id=28844">28844</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Code is not optimized with -O2 when used with variadic arguments
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.9
          </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>normal
          </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>kris@jusiak.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>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=16881" name="attach_16881" title="Simple case demonstrating the bug">attachment 16881</a> <a href="attachment.cgi?id=16881&action=edit" title="Simple case demonstrating the bug">[details]</a></span>
Simple case demonstrating the bug

Started to happen in 3.9 and trunk. Previous versions work fine.

struct config {
  static int f(...) { return 42; }
};

int main() {
  return config::f();
}

Clang-3.9: compiled with -O2 -S gives:
  xor    %eax,%eax
  jmpq   0x403540 <_ZN6config1fEz>

Clang-3.8 or less, or GCC, or MSVC gives:
  movl    $42, %eax
  retq

It's just a simplified example, however, technic with variadic args is popular
in the context of SFINAE.

Due to this issue C++14 dependency injection library
(<a href="https://github.com/boost-experimental/di">https://github.com/boost-experimental/di</a>) is not optimizing bindings with
clang-3.9.</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>