[LLVMbugs] [Bug 2553] New: Invalid float optimization with NaN

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Jul 16 18:27:23 PDT 2008


           Summary: Invalid float optimization with NaN
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: NetBSD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: krister.walfridsson at gmail.com
                CC: llvmbugs at cs.uiuc.edu

llvm-gcc-4.2 (svn revision 53688) miscompiles some functions in libgcc (for
example __mulxc3) because llvm simplifies the code for its isfinite() a bit too

You can see this for:

  #define isnan(x)      ((x) != (x))
  #define isfinite(x)   (!isnan((x) - (x)))

  void foo(float x)
      if (isfinite(x))


  gcc -O0 -S -emit-llvm bug.c

gives me the attached bug.ll, and executing

  llvm-as < bug.ll | opt -std-compile-opts | llvm-dis


  define void @foo(float %x) nounwind  {
        tail call i32 (...)* @bar( ) nounwind           ; <i32>:0 [#uses=0]
        ret void

  declare i32 @bar(...)

i.e. it has optimized away the test for isfinite().

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