[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


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

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

You can see this for:

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

  void foo(float x)
  {
      if (isfinite(x))
          bar();
  }

Running

  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

gives

  define void @foo(float %x) nounwind  {
  entry:
        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