[LLVMbugs] [Bug 2003] Incorrect iteration count for loop with unsigned ICMP condition

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Feb 12 05:41:02 PST 2008


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


Wojciech Matyjewicz <wmatyjewicz at fastmail.fm> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |




--- Comment #2 from Wojciech Matyjewicz <wmatyjewicz at fastmail.fm>  2008-02-12 07:40:54 ---
> If %n = 0, then we get %n - 100 = -100 = +156 (unsigned). And this is the
> correct loop trip count; if you start at 100, it'll take you 156 (256-100)
> iterations to get back around to zero.

Please, note that the comparison operator is ULT and not NE. What you are
saying is true in the second case. Suppose %n = 0. Then the first execution of:
        %cond = icmp ult i32 %i, %n
defines %cond as false and causes the loop to end. So, the trip count should be
0 in this case.


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