[LLVMbugs] [Bug 6761] New: optimizer generates an infinite loop with floating-point counter.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Apr 1 16:34:02 PDT 2010


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

           Summary: optimizer generates an infinite loop with
                    floating-point counter.
           Product: libraries
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Loop Optimizer
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: nanki at dotswitch.net
                CC: llvmbugs at cs.uiuc.edu


I tested the following code which prints 'H' 10 times.

-- h.ll
; ModuleID = '<stdin>'

define void @main() nounwind {
; <label>:0
  br label %1

; <label>:1                                       ; preds = %1, %0
  %2 = phi double [ 9.000000e+00, %0 ], [ %4, %1 ] ; <double> [#uses=1]
  %3 = call i32 @putchar(i8 72)                   ; <i32> [#uses=0]
  %4 = fsub double %2, 1.000000e+00               ; <double> [#uses=2]
  %5 = fcmp oge double %4, 0.000000e+00           ; <i1> [#uses=1]
  br i1 %5, label %1, label %6

; <label>:6                                       ; preds = %1
  ret void
}

declare i32 @putchar(i8) nounwind
--

$ cat h.ll | llvm-as | lli
HHHHHHHHHH

But with optimization, it turns out an infinite loop.

$ cat h.ll | llvm-as | opt -O1 | lli
HHHHHHHHHHHHH...

* Using i32 counter works well with optimization.
* This problem seems to be happened when the delta is 1.0, 2.0, 3.0...
* See also http://llvm.org/bugs/show_bug.cgi?id=3299

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