[llvm-bugs] [Bug 28844] New: Code is not optimized with -O2 when used with variadic arguments

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 4 07:48:56 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28844

            Bug ID: 28844
           Summary: Code is not optimized with -O2 when used with variadic
                    arguments
           Product: clang
           Version: 3.9
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kris at jusiak.net
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 16881
  --> https://llvm.org/bugs/attachment.cgi?id=16881&action=edit
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
(https://github.com/boost-experimental/di) is not optimizing bindings with
clang-3.9.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160804/fb31379a/attachment.html>


More information about the llvm-bugs mailing list