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: unassignedclangb...@nondot.org
          Reporter: k...@jusiak.net
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to