[PATCH] ScalarEvolution incorrectly assumes that the start of certain add recurrences don't overflow

hfinkel at anl.gov hfinkel at anl.gov
Fri Feb 6 22:16:37 PST 2015


In http://reviews.llvm.org/D7331#120156, @sanjoy wrote:

> > You mentioned that you can replace this with a correct version. I would love to see that!
>
>
> I initially thought that this optimization was valid if the loop had at most one exiting block; but that is not correct.  That one exiting block could be an early exit that leaves the loop before computing the pre-incremented induction variable.


Right, you'd need to phrase the condition as Andy suggested:

> Something like: L->getExitBlock() == L->getLoopLatch()


(where you also need to make sure that both are not nullptr). If the exit block is also the latch block, then there is no early-exit problem.


http://reviews.llvm.org/D7331

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list