[LLVMbugs] [Bug 17151] New: missed optimization: unused std::string

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Sep 8 02:07:41 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=17151

            Bug ID: 17151
           Summary: missed optimization: unused std::string
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ruslan_baratov at yahoo.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

>cat test.cpp
#include <string>

void foo() {
  std::string a = "abc";
}

void boo() {
}

Expected, that both 'foo' and 'boo' produce same asm, but it's not:

>clang++ -O3 -stdlib=libc++ -save-temps -O3 -c -fomit-frame-pointer test.cpp
>cat test.s
__Z3foov:                               ## @_Z3foov
    pushq    %rbx
    subq    $32, %rsp
    leaq    8(%rsp), %rbx
    leaq    L_.str(%rip), %rsi
    movq    %rbx, %rdi
    movl    $3, %edx
    callq   
__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcm
    movq    %rbx, %rdi
    callq   
__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED1Ev
    addq    $32, %rsp
    popq    %rbx
    ret

__Z3boov:                               ## @_Z3boov
    ret

-- 
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/20130908/d5bb07dd/attachment.html>


More information about the llvm-bugs mailing list