[LLVMbugs] [Bug 4086] New: float induction variable elimination issue

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sun Apr 26 20:48:50 PDT 2009


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

           Summary: float induction variable elimination issue
           Product: libraries
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: major
          Priority: P2
         Component: Loop Optimizer
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: markleone at gmail.com
                CC: llvmbugs at cs.uiuc.edu


I think this code tickles a bug in float induction variable elimination.  

declare void @foo()

define void @test() {
entry:
        br label %loop_body

loop_body:              
        %i = phi float [ %nexti, %loop_body ], [ 0.0, %entry ]          
        tail call void @foo()
        %nexti = add float %i, 1.0              
        %less = fcmp olt float %nexti, 2.0              
        br i1 %less, label %loop_body, label %done

done:           
        ret void
}

To replicate: llvm-as test.ll ; opt -indvars test.bc | llvm-dis 
The resulting code has a bogus less-than comparison, leading to an infinite
loop.

define void @test() {
entry:
        br label %loop_body

loop_body:              
        %i.int = phi i32 [ 0, %entry ], [ %indvar.next, %loop_body ]            
        tail call void @foo()
        %less1 = icmp ult i32 0, 2                      ; XXX should be %i.int,
not 0.
        %indvar.next = add i32 %i.int, 1                
        br i1 %less1, label %loop_body, label %done

done:           
        ret void
}


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