[LLVMbugs] [Bug 17582] New: inefficient local dynamic code on x86_64

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Oct 14 15:20:33 PDT 2013


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

            Bug ID: 17582
           Summary: inefficient local dynamic code on x86_64
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: rafael.espindola at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

given

__attribute__((visibility("hidden")))  __thread int obj1;
__attribute__((visibility("hidden")))  __thread int obj2;

void f(int, int);
void test() {
  f(((int)&obj1) > 0, ((int)&obj2) > 0);
}

clang correctly selects the local dynamic model (just one call to
__tls_get_addr), but the code is


        leaq    obj1 at TLSLD(%rip), %rdi
        callq   __tls_get_addr at PLT
        movq    %rax, %rcx
        movq    $obj1 at DTPOFF, %rdi
        addl    %ecx, %edi
        movq    $obj2 at DTPOFF, %rsi
        addl    %eax, %esi

the movq %rax, %rcx seems pointless. We can just add from %eax directly.

-- 
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/20131014/0b800d2d/attachment.html>


More information about the llvm-bugs mailing list