[SCEV] Handle zero stride correctly in howManyLessThans
authorPhilip Reames <listmail@philipreames.com>
Tue, 13 Jul 2021 20:30:44 +0000 (13:30 -0700)
committerEli Friedman <efriedma@quicinc.com>
Wed, 14 Jul 2021 02:14:01 +0000 (19:14 -0700)
commit205ed009a44c2b04a15aea039d8947e74856f158
tree9f7349fbd262ad3a526a94245c3bae4772396014
parent8a0f1163d02c77c6e764929b66c26ba196cfc549
[SCEV] Handle zero stride correctly in howManyLessThans

This is split from D105216, but the code is hoisted much earlier into
the path where we can actually get a zero stride flowing through. Some
fairly simple proofs handle the cases which show up in practice. The
only test changes are the cases where we really do need a non-zero
divider to produce the right result.

Recommitting with isLoopInvariant() check.

Differential Revision: https://reviews.llvm.org/D105921
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/test/Analysis/ScalarEvolution/trip-count-unknown-stride.ll