[ScalarEvolution] Fix overflow when computing max trip counts
authorPhilip Reames <listmail@philipreames.com>
Tue, 13 Jul 2021 16:58:19 +0000 (09:58 -0700)
committerPhilip Reames <listmail@philipreames.com>
Tue, 13 Jul 2021 17:01:10 +0000 (10:01 -0700)
commite4b43973fbd41aee3b8197cf250e9fb9ac40f986
treeb461815b2a190d918f60831848d569e33b5eb5f4
parent489742991f7dc4c621264d223e8973ff876e9080
[ScalarEvolution] Fix overflow when computing max trip counts

This is split from D105216 to reduce patch complexity.  Original code by Eli with very minor modification by me.

The primary point of this patch is to add the getUDivCeilSCEV routine.  I included the two callers with constant arguments as we know those must constant fold even without any of the fancy inference logic.
llvm/include/llvm/Analysis/ScalarEvolution.h
llvm/lib/Analysis/ScalarEvolution.cpp