[LLVMbugs] [Bug 3299] New: LLVM optimizer can' t eliminate loop with floating point counter

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Jan 8 09:17:03 PST 2009


           Summary: LLVM optimizer can't eliminate loop with floating point
           Product: libraries
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Loop Optimizer
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: syoyofujita at gmail.com
                CC: llvmbugs at cs.uiuc.edu

LLVM optimizer fails to eliminate following dead loop with floating point
(The exception is that i is incremented by 1.0f)

/* floop.c */
func() {
   float i;
   for (i = 0.0f; i < 1000.0f; i += 1.2f) {

$ clang -emit-llvm-bc floop.c
$ opt -std-compile-opts floop.bc | llvm-dis

opt -std-compile-opts test.bc | llvm-dis
; ModuleID = '<stdin>'
target datalayout =
target triple = "i386-apple-darwin9"

define void @func(...) nounwind readnone {
        br label %for.inc

for.inc:                ; preds = %for.inc, %entry
        %i.0.reg2mem.0 = phi float [ 0.000000e+00, %entry ], [ %add, %for.inc
]; <float> [#uses=1]
        %add = add float %i.0.reg2mem.0, 0x3FF3333340000000             ;
<float> [#uses=2]
        %cmp = fcmp olt float %add, 1.000000e+03                ; <i1>
        br i1 %cmp, label %for.inc, label %return

return:         ; preds = %for.inc
        ret void

(loop wasn't eliminated after optimization)

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