[PATCH] [SCEV] make SCEV smarter about proving no-wrap.

Andrew Trick atrick at apple.com
Tue Mar 3 23:57:22 PST 2015


> On Mar 3, 2015, at 11:14 PM, Sanjoy Das <sanjoy at playingwithpointers.com> wrote:
> 
> On Tue, Mar 3, 2015 at 11:10 PM, Andrew Trick <atrick at apple.com> wrote:
>> 
>>> On Mar 3, 2015, at 11:07 PM, Sanjoy Das <sanjoy at playingwithpointers.com> wrote:
>>> 
>>> ================
>>> Comment at: lib/Analysis/ScalarEvolution.cpp:1357
>>> @@ +1356,3 @@
>>> +//
>>> +// If (S-T)+T does not overflow  ... (3)
>>> +//
>>> ----------------
>>> atrick wrote:
>>>> I still don't see the bug. How can (3) be false with (1) and (2)? A counter example would help.
>>> You're right, (3) is just (1) in the 0th iteration.  I'll fix this.
>> 
>> Well, step (X) could be less than (T), but either way it’s covered by (1) or (2).
> 
> I'm not using any knowledge of Step/X.  (1) is "({S-T,+,X} + T) does
> not overflow".  In the 0th iteration (before the backedge is taken
> even once) this implies ((S-T)+T) does not overflow.  Am I missing
> something?

I was thinking of (1) as only pertaining to the final value of the recurrence. But of course the expression could be used within the loop. So I think you’re right.

-Andy

> 
> -- Sanjoy
> 
>> -Andy
>> 
>>> 
>>> http://reviews.llvm.org/D7980
>>> 
>>> EMAIL PREFERENCES
>>> http://reviews.llvm.org/settings/panel/emailpreferences/
>>> 
>>> 
>> 





More information about the llvm-commits mailing list