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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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@TLSLD(%rip), %rdi
        callq   __tls_get_addr@PLT
        movq    %rax, %rcx
        movq    $obj1@DTPOFF, %rdi
        addl    %ecx, %edi
        movq    $obj2@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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to