When we're remapping an AddRec, the AddRec constructed by a partial rewrite might not make sense. This triggers an assertion complaining it's not loop-invariant.
Instead of constructing the partially rewritten AddRec, just skip straight to calling evaluateAtIteration.
Testcase was automatically reduced using llvm-reduce, so it's a little messy, but hopefully makes sense.
clang-format: please reformat the code
-const SCEV * -SCEVAddRecExpr::evaluateAtIteration(ArrayRef<const SCEV *> Operands, - const SCEV *It, ScalarEvolution &SE) { +const SCEV *SCEVAddRecExpr::evaluateAtIteration(ArrayRef<const SCEV *> Operands, + const SCEV *It, + ScalarEvolution &SE) {