[LoopLoadElim] Filter away candidates that stop being AddRecs after loop versioning...
authorMax Kazantsev <mkazantsev@azul.com>
Thu, 10 Sep 2020 06:29:45 +0000 (13:29 +0700)
committerMax Kazantsev <mkazantsev@azul.com>
Thu, 10 Sep 2020 06:30:31 +0000 (13:30 +0700)
commitc413a8a8ecd3c0ef7bcb08525fd73eb1392a738c
tree9d269ff01983e1caf1c81b5bd86703e7d403bbbf
parent060c8e083dd637866854acb6a0823c45b2ef68ef
[LoopLoadElim] Filter away candidates that stop being AddRecs after loop versioning. PR47457

The test in PR47457 demonstrates a situation when candidate load's pointer's SCEV
is no loger a SCEVAddRec after loop versioning. The code there assumes that it is
always a SCEVAddRec and crashes otherwise.

This patch makes sure that we do not consider candidates for which this requirement
is broken after the versioning.

Differential Revision: https://reviews.llvm.org/D87355
Reviewed By: asbirlea
llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp
llvm/test/Transforms/LoopLoadElim/pr47457.ll