[LLVMbugs] [Bug 7416] New: scev miscomputes multi-backedge loop

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jun 18 21:40:47 PDT 2010


           Summary: scev miscomputes multi-backedge loop
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Loop Optimizer
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: nicholas at mxc.ca
                CC: llvmbugs at cs.uiuc.edu

Created an attachment (id=5056)
 --> (http://llvm.org/bugs/attachment.cgi?id=5056)
hand-coded testcase

The attached program shows a loop from 0 to 100 in steppings of either 2 or 3
each iteration as controlled by an external function. SCEV claims that this has
a max backedge-taken count of 50 (perfect!) and that the exact backedge-taken
count is also 50. Oops!

$ opt -analyze -scalar-evolution loop.ll
Printing analysis 'Scalar Evolution Analysis' for function 'f':
Classifying expressions for: @f
  %x = phi i32 [ 0, %entry ], [ %x.1, %bb1 ], [ %x.2, %bb2 ] ; <i32> [#uses=3]
  -->  %x               Exits: 100
  %z = call i1 @g()                               ; <i1> [#uses=1]
  -->  %z               Exits: <<Unknown>>
  %x.1 = add i32 %x, 2                            ; <i32> [#uses=1]
  -->  (2 + %x)         Exits: 102
  %x.2 = add i32 %x, 3                            ; <i32> [#uses=1]
  -->  (3 + %x)         Exits: 103
Determining loop execution counts for: @f
Loop %loophead: backedge-taken count is 50
Loop %loophead: max backedge-taken count is 50

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