[llvm-bugs] [Bug 37511] New: Supoptimal jumps in code generation

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 17 14:22:21 PDT 2018


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

            Bug ID: 37511
           Summary: Supoptimal jumps in code generation
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at lists.llvm.org

Hello,

code:

int main () {

  std::ifstream is ("test.txt", std::ifstream::binary);
  if (is) {
    // get length of file:
    is.seekg (0, is.end);
    int length = is.tellg();
    is.seekg (0, is.beg);
  }
  return 0;
}

clang++ -O3 -stdlib=libc++

Lines with **** look strange for me.

X86 ASM:
...
  pop r15
  ret
  jmp .LBB0_15              ******
.LBB0_15:
  mov r15, rax
  mov qword ptr [rsp], offset vtable for std::__1::basic_ifstream<char,
std::__1::char_traits<char> >+24
  mov qword ptr [rsp + 184], offset vtable for std::__1::basic_ifstream<char,
std::__1::char_traits<char> >+64
  jmp .LBB0_16 
  mov r15, rax              ******
.LBB0_16:
  mov rdi, rbx
  call std::__1::basic_filebuf<char, std::__1::char_traits<char>
>::~basic_filebuf()
  jmp .LBB0_17
  mov r15, rax              ******
.LBB0_17:
...


Godbolt link: https://godbolt.org/g/iSAZxM (lines 70 - 80)

-- 
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/20180517/4829528d/attachment.html>


More information about the llvm-bugs mailing list