[polly] Fix SCEVLoopAddRecRewriter to avoid invalid AddRecs.
authorEli Friedman <efriedma@quicinc.com>
Fri, 21 May 2021 23:58:36 +0000 (16:58 -0700)
committerEli Friedman <efriedma@quicinc.com>
Tue, 1 Jun 2021 16:51:05 +0000 (09:51 -0700)
commitfd229caa0138d296090c101655c82ca7da58ddd6
tree5178a61a09e1e5d3a7f65c59e70af8251ac5c62d
parentfd7e309e02fd226b0390888388ed732608e52c73
[polly] Fix SCEVLoopAddRecRewriter to avoid invalid AddRecs.

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.

Differential Revision: https://reviews.llvm.org/D102959
llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h
llvm/lib/Analysis/ScalarEvolution.cpp
polly/test/Isl/CodeGen/OpenMP/scev-rewriting.ll [new file with mode: 0644]