[LLVMbugs] [Bug 12380] New: Slow code is generated for -fPIE and TLS on linux (gcc does better)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Mar 27 18:22:55 PDT 2012


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

             Bug #: 12380
           Summary: Slow code is generated for -fPIE and TLS on linux (gcc
                    does better)
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: kcc at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


clang r153443, linux x86_64 

clang generates slow code for TLS and -fPIE on linux
(i.e. it does the same as for -fPIC)
gcc generates much better code for -fPIE


% cat x.c
__thread int x;
void foo() {
  x = 0;
}

% gcc -O3 -c x.c -fPIC && objdump -d x.o  | grep foo.: -A 10
0000000000000000 <foo>:
   0:   66 48 8d 3d 00 00 00    lea    0x0(%rip),%rdi        # 8 <foo+0x8>
   7:   00 
   8:   66 66 48 e8 00 00 00    callq  10 <foo+0x10>
   f:   00 
  10:   c7 00 00 00 00 00       movl   $0x0,(%rax)
  16:   c3                      retq   
% gcc -O3 -c x.c -fPIE && objdump -d x.o  | grep foo.: -A 10
0000000000000000 <foo>:
   0:   64 c7 04 25 00 00 00    movl   $0x0,%fs:0x0
   7:   00 00 00 00 00 
   c:   c3                      retq   
% clang -O3 -c x.c -fPIE && objdump -d x.o  | grep foo.: -A 10
0000000000000000 <foo>:
   0:   50                      push   %rax
   1:   66 48 8d 3d 00 00 00    lea    0x0(%rip),%rdi        # 9 <foo+0x9>
   8:   00 
   9:   66 66 48 e8 00 00 00    callq  11 <foo+0x11>
  10:   00 
  11:   c7 00 00 00 00 00       movl   $0x0,(%rax)
  17:   58                      pop    %rax
  18:   c3                      retq   
%

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list