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

           Summary: LLVM optimizer can't eliminate loop with floating point
                    counter
           Product: libraries
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Loop Optimizer
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


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

/* floop.c */
void
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 =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "i386-apple-darwin9"

define void @func(...) nounwind readnone {
entry:
        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>
[#uses=1]
        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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to