[LLVMbugs] [Bug 6799] New: clang -O2 emits wrong asm
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Apr 6 13:51:06 PDT 2010
http://llvm.org/bugs/show_bug.cgi?id=6799
Summary: clang -O2 emits wrong asm
Product: clang
Version: unspecified
Platform: PC
OS/Version: FreeBSD
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: rdivacky at freebsd.org
CC: llvmbugs at cs.uiuc.edu
when compiling the attached gcc produces this code:
gcc -S -O2 tree1.c:
getcnode:
.LFB6:
movq %rbx, -24(%rsp)
.LCFI0:
movq %r12, -16(%rsp)
.LCFI1:
movq %rsi, %r12
movq %r13, -8(%rsp)
.LCFI2:
subq $24, %rsp
.LCFI3:
movq %rdi, %r13
call getnode
movl $32, %edi
movq %rax, %rbx
movq %r13, 8(%rax)
movl $47, (%rax)
call tgetblk
movq %rax, 24(%rbx)
movl (%r13), %edx
movq %r12, %rdi
movl %edx, (%rax)
movl 4(%r12), %eax
movq 24(%rbx), %rdx
movl %eax, 4(%rdx)
movq 16(%r12), %rax
movq 24(%rbx), %rdx
movq %rax, 16(%rdx)
movq 24(%r12), %rax (1)
movq %rax, 24(%rdx) (2)
call free
movq %rbx, %rax
movq 8(%rsp), %r12
movq (%rsp), %rbx
movq 16(%rsp), %r13
addq $24, %rsp
ret
while clang -S -O2 tree1.c:
getcnode:
.Leh_func_begin1:
pushq %rbp
.Ltmp0:
movq %rsp, %rbp
.Ltmp1:
pushq %r15
pushq %r14
pushq %rbx
subq $8, %rsp
.Ltmp2:
movq %rsi, %rbx
movq %rdi, %r14
callq getnode
movq %rax, %r15
movl $47, (%r15)
movq %r14, 8(%r15)
movl $32, %edi
callq tgetblk
movq %rax, 24(%r15)
movl (%r14), %ecx
movl %ecx, (%rax)
movq 24(%r15), %rax
movl 4(%rbx), %ecx
movl %ecx, 4(%rax)
movq 24(%r15), %rax
movaps 16(%rbx), %xmm0 (3)
movaps %xmm0, 16(%rax) (4)
movq %rbx, %rdi
callq free
movq %r15, %rax
addq $8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
ret
note that the offset for (1) and (2) is 24 for gcc while 16 for clang at (3)
and (4), this makes "lint" crash
--
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