[LLVMbugs] [Bug 17173] New: [SCEV] Negative backedge-taken count on signed integer wrap of the induction variable

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Sep 9 17:38:53 PDT 2013


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

            Bug ID: 17173
           Summary: [SCEV] Negative backedge-taken count on signed integer
                    wrap of the induction variable
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Global Analyses
          Assignee: unassignedbugs at nondot.org
          Reporter: surfmaths at free.fr
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 11173
  --> http://llvm.org/bugs/attachment.cgi?id=11173&action=edit
Simple loop with bit-width minimization of the induction variable

In case the induction variable undergoes a legal signed wrap, the exit
condition is usually negative. (cf: example code where the induction variable
bit-width has been minimized)

The Scalar Evolution Analysis gives a negative backedge-taken count in such
cases.

To reproduce:

$ opt -scalar-evolution -analyze test.ll
Printing analysis 'Scalar Evolution Analysis' for function 'test':
Classifying expressions for: @test
  %i = phi i7 [ 0, %preheader ], [ %i.1, %body.incr ]
  -->  {0,+,1}<%header>        Exits: -28
  %tmp = zext i7 %i to i64
  -->  {0,+,1}<nuw><nsw><%header>        Exits: 100
  %A.addr = getelementptr [100 x i32]* @A, i64 0, i64 %tmp
  -->  {@A,+,4}<%header>        Exits: (400 + @A)
  %A.load = load i32* %A.addr, align 4
  -->  %A.load        Exits: <<Unknown>>
  %A.inc = zext i7 %i to i32
  -->  {0,+,1}<nuw><nsw><%header>        Exits: 100
  %A.val = add nsw i32 %A.load, %A.inc
  -->  ({0,+,1}<nuw><nsw><%header> + %A.load)        Exits: <<Unknown>>
  %i.1 = add i7 %i, 1
  -->  {1,+,1}<nw><%header>        Exits: -27
Determining loop execution counts for: @test
Loop %header: backedge-taken count is -28
Loop %header: max backedge-taken count is -28


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190205
91177308-0d34-0410-b5e6-96231b3b80d8

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130910/ddde3eb0/attachment.html>


More information about the llvm-bugs mailing list