[LLVMbugs] [Bug 2052] New: Invalid instcombine for float division with undef

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sun Feb 17 05:44:21 PST 2008


           Summary: Invalid instcombine for float division with undef
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sharparrow1 at yahoo.com
                CC: llvmbugs at cs.uiuc.edu

define float @a(float %x) {
%res = fdiv float undef, %x
ret float %res

instcombines to:

define float @a(float %x) nounwind  {
        ret float 0.000000e+00

If I understand the rules for undef correctly, this is an invalid
transformation because since x/NaN is NaN for all x, the division returns an
impossible result in the case where %x is an NaN.

I think a correct transformation is undef/X->NaN, because NaN/x is NaN for all
x. In the case of signaling floating point, we can't actually do the
transformation at all, because the operation might be required to signal.  But
we normally assume no floating point exceptions, right?

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