This is an archive of the discontinued LLVM Phabricator instance.

[ScalarEvolution][NFC] Refactor howManyLessThans
AbandonedPublic

Authored by efriedma on Jul 12 2021, 7:35 PM.

Details

Summary

Include an actual proof of the property we care about, and add FIXMEs for the missing correctness checks. Also, some related cleanup.

Split off from D105216.

Diff Detail

Event Timeline

efriedma created this revision.Jul 12 2021, 7:35 PM
efriedma requested review of this revision.Jul 12 2021, 7:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 12 2021, 7:35 PM
efriedma added inline comments.Jul 13 2021, 1:38 AM
llvm/lib/Analysis/ScalarEvolution.cpp
11784

Thinking about this a bit more, we might be able to get away with using this path even if we can't prove RHS > Start - Stride. We could use something like (max(RHS, Start - (Stride - 1)) - (Start - (Stride - 1))) /u Stride, I think. Not confident I wrote that exactly right.

Not sure how much that improves things in practice, though; the logic on this path is still predicated on the assumption that Start - (Stride - 1) doesn't overflow.

efriedma updated this revision to Diff 358403.Jul 13 2021, 1:04 PM

Rebased. Comment updated to address review comments.

efriedma abandoned this revision.Jul 15 2021, 1:22 PM

Basically everything here has landed.