[LLVMbugs] [Bug 1227] NEW: Can't compute trip count of simple loop

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sun Feb 25 12:45:45 PST 2007


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

           Summary: Can't compute trip count of simple loop
           Product: libraries
           Version: 1.0
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Global Analyses
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sabre at nondot.org
                CC: dpatel at apple.com


This simple loop should be getting unrolled:

target datalayout = "e-p:32:32"
target triple = "i686-apple-darwin8"

implementation   ; Functions:

define void @_Z6assignPll(i32* %variable, i32 %v) {
entry:
        br label %bb63

bb63:           ; preds = %bb63, %entry
        %__result.0203.0.rec = phi i32 [ 0, %entry ], [ %indvar.next, %bb63 ]           ; <i32> [#uses=3]
        %__result.0203.0 = getelementptr i32* %variable, i32 %__result.0203.0.rec               ; <i32*> 
[#uses=1]
        store i32 %v, i32* %__result.0203.0
        icmp eq i32 %__result.0203.0.rec, 2             ; <i1>:0 [#uses=1]
        %indvar.next = add i32 %__result.0203.0.rec, 1          ; <i32> [#uses=1]
        br i1 %0, label %bb193, label %bb63

bb193:          ; preds = %bb63
        ret void
}

However, it doesn't currently because the icmp is using the PHI node, not the increment.  Because of 
this, this trivial loop doesn't get unrolled.  This comes from this simple example:

#include <tr1/functional>
#include <algorithm>
void assign( long* variable, long v ) {
        std::transform( variable, variable + 3, variable,
                std::tr1::bind( std::plus< long >(), 0L, v ) );
}

-Chris



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the llvm-bugs mailing list