[SCEV] Handle zero stride correctly in howManyLessThans
authorPhilip Reames <listmail@philipreames.com>
Tue, 13 Jul 2021 20:30:44 +0000 (13:30 -0700)
committerPhilip Reames <listmail@philipreames.com>
Tue, 13 Jul 2021 20:31:40 +0000 (13:31 -0700)
commit4df591b5c960affd1612e330d0c9cd3076c18053
treea5f3550133d8df91640046ee5882c4ac4316295c
parent1c69005c2e11414669ac8ba094a9b059920936db
[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.

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