[LLVMbugs] [Bug 2656] New: x86 codegen error with byval struct parameter

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sat Aug 9 23:00:42 PDT 2008


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

           Summary: x86 codegen error with byval struct parameter
           Product: libraries
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Backend: X86
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: daniel at zuster.org
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=1908)
 --> (http://llvm.org/bugs/attachment.cgi?id=1908)
Test case

The following code (attached) is miscompiled:
--
define void @foo(%struct.anon* byval %p) nounwind {
entry:
        %tmp = getelementptr %struct.anon* %p, i32 0, i32 0             ;
<float*> [#uses=1]
        %tmp1 = load float* %tmp                ; <float> [#uses=1]
        %tmp2 = getelementptr %struct.anon* %p, i32 0, i32 1            ;
<float*> [#uses=1]
        %tmp3 = load float* %tmp2               ; <float> [#uses=1]
        %neg = sub float -0.000000e+00, %tmp1           ; <float> [#uses=1]
        %conv = fpext float %neg to double              ; <double> [#uses=1]
        %neg4 = sub float -0.000000e+00, %tmp3          ; <float> [#uses=1]
        %conv5 = fpext float %neg4 to double            ; <double> [#uses=1]
        %call = call i32 (...)* @printf( i8* getelementptr ([17 x i8]* @.str,
i32 0, i32 0), double %conv, double %conv5 )              ; <i32> [#uses=0]
        ret void
}
--

This compiles to the following, and the memory access for the first xorps is
not properly aligned:
--
_foo:
        subl    $28, %esp
        movss   LCPI1_0, %xmm0
        movaps  %xmm0, %xmm1
        xorps   36(%esp), %xmm1
        xorps   32(%esp), %xmm0
        cvtss2sd        %xmm1, %xmm1
        movsd   %xmm1, 12(%esp)
        cvtss2sd        %xmm0, %xmm0
        movsd   %xmm0, 4(%esp)
        movl    $_.str, (%esp)
        call    L_printf$stub
        addl    $28, %esp
        ret
--


-- 
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