LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 1012 - fp stackifier broken
Summary: fp stackifier broken
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Backend: X86 (show other bugs)
Version: trunk
Hardware: PC Linux
: P normal
Assignee: Chris Lattner
URL:
Keywords: miscompilation
Depends on:
Blocks:
 
Reported: 2006-11-19 15:54 PST by Nick Lewycky
Modified: 2010-02-22 12:42 PST (History)
1 user (show)

See Also:
Fixed By Commit(s):


Attachments
bugpoint reduced testcase (443 bytes, application/octet-stream)
2006-11-19 15:54 PST, Nick Lewycky
Details
matching x86 assembly (1.10 KB, text/plain)
2006-11-19 16:04 PST, Nick Lewycky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Lewycky 2006-11-19 15:54:03 PST
Latest CVS (since about a week ago) broke a dozen tests in my nightly. Testcase
attached.
Comment 1 Nick Lewycky 2006-11-19 15:54:55 PST
Created attachment 469 [details]
bugpoint reduced testcase

Miscompile. If you need any more information (like the llc generated .s) just
ask.
Comment 2 Nick Lewycky 2006-11-19 16:04:13 PST
Created attachment 470 [details]
matching x86 assembly

Ah, it's small. Attaching the asm.
Comment 3 Reid Spencer 2006-11-19 16:51:17 PST
Nick,

I was getting something similar until I updated my CFE this morning. Did you
update your CFE and rebuild?

Reid.
Comment 4 Nick Lewycky 2006-11-19 16:52:59 PST
No, I rebuilt it right before building LLVM. I try to have a working LLVM before
building the CFE.

I'll try it now.
Comment 5 Nick Lewycky 2006-11-19 17:14:11 PST
No change.
Comment 6 Reid Spencer 2006-11-19 18:29:10 PST
Builds and tests okay here. Dunno.
Comment 7 Chris Lattner 2006-11-20 11:36:44 PST
Reduced testcase:

float %foo(float *%col.2.0) {
        %tmp = load float* %col.2.0             ; <float> [#uses=3]
        %tmp16 = setlt float %tmp, 0.000000e+00         ; <bool> [#uses=1]
        %tmp20 = sub float -0.000000e+00, %tmp          ; <float> [#uses=1]
        %iftmp.2.0 = select bool %tmp16, float %tmp20, float %tmp
        ret float %iftmp.2.0
}

compiles to:

$ llvm-as < t.ll | llc -mcpu=i386
_foo:
        movl 4(%esp), %eax
        flds (%eax)
        fld %st(0)
        fchs
        fldz
        fucomip %st(0), %st(0)
        fxch %st(1)
        fcmovnbe %st(1), %st(0)
        fstp %st(1)
        #FP_REG_KILL
        ret

Note that the fucomip compares two zeros against each other.  This is probably fallout from Evan's 
recent patch.

-Chris
Comment 8 Chris Lattner 2006-11-20 11:59:04 PST
Fixed.  Testcase here: CodeGen/X86/fp-stack-compare.ll
Patch here:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20061120/040133.html
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20061120/040134.html

-Chris