[PATCH] Fix bug 22641

Sanjoy Das sanjoy at playingwithpointers.com
Mon Feb 23 15:00:24 PST 2015


> Good. So that’s true for all users of a value that evaluates to the <nsw> SCEV regardless of whether they are conditionally executed outside the loop. More generally, once that back-edge is taken, integer overflow induces undefined behavior. i.e. it doesn’t matter whether the IV was actually tested on the backedge or even used on any path that the program takes. That way we can use the presence of the SCEV flags on a recurrence to prove things about other recurrences. Right?

Yes.  I don't think of SCEV's as causing UB since they are not
executable, but I think of them more like proofs; but that's a minor
detail.


>> and {S,+,1}<nsw> is still always sge 1.
>
> I’m missing something here. We *don’t* know that ({S,+,1}<nsw> - {S-1,+,1}<nsw>) sge 1.

Sorry, that's a typo on my part.  I meant to write {1,+,1}<nsw> is
known to be sge 1.

>>  {S,+,X}+X == {S+X,+,X} is
>> a totally different scev and the no-wrap behavior of the former does
>> not apply to the latter.
>
> Yes.  But you could use NSW on one of the recurrences to help prove the other. e.g. after proving that the first increment doesn’t overflow.

Yes.

Thanks,
-- Sanjoy




More information about the llvm-commits mailing list