[unittest] Exercise SCEV's udiv and udiv ceiling routines
authorPhilip Reames <listmail@philipreames.com>
Thu, 15 Jul 2021 17:59:02 +0000 (10:59 -0700)
committerPhilip Reames <listmail@philipreames.com>
Thu, 15 Jul 2021 18:55:00 +0000 (11:55 -0700)
commitb980d2f54bb652208eeb9a6543b8d838b65ad099
tree6005541949defb28bb885f2c10ff68eca9173643
parent8fb47456a356c5bfe0046a9d1c74cb048a4624bf
[unittest] Exercise SCEV's udiv and udiv ceiling routines

The ceiling variant was recently added (due to the work towards D105216), and we're spending a lot of time trying to find optimizations for the expression. This patch brute forces the space of i8 unsigned divides and checks that we get a correct (well consistent with APInt) result for both udiv and udiv ceiling.

(This is basically what I've been doing locally in a hand rolled C++ program, and I realized there no good reason not to check it in as a unit test which directly exercises the logic on constants.)

Differential Revision: https://reviews.llvm.org/D106083
llvm/include/llvm/Analysis/ScalarEvolution.h
llvm/unittests/Analysis/ScalarEvolutionTest.cpp