[NFCI][SCEV] getPtrToIntExpr(): use SCEVRewriteVisitor<> for ptrtoint cast sinking
authorRoman Lebedev <lebedev.ri@gmail.com>
Fri, 30 Oct 2020 12:34:11 +0000 (15:34 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Fri, 30 Oct 2020 14:05:14 +0000 (17:05 +0300)
commitef22d500f7505d02a3861a9acf7eaacb375c7652
tree948eca1c1213f4289df2407771d23368eba39f5f
parent73f01e3df58dca9d1596440b866b52929e3878de
[NFCI][SCEV] getPtrToIntExpr(): use SCEVRewriteVisitor<> for ptrtoint cast sinking

This is functionally-identical to the previous implementation,
just using a generic interface to do that instead of hand-rolled one,
with caching as a bonus. Thought the sinking is still recursive..

Note that SCEVRewriteVisitor<>'s default implementations
don't preserve NoWrap flags on Add/Mul (but does on AddRec!),
but here we know we can preserve them,
so `visitAddExpr()`/`visitMulExpr()` are specialized.
llvm/lib/Analysis/ScalarEvolution.cpp