[IndVarSimplify][LoopUtils] rewriteLoopExitValues. NFCI
authorSjoerd Meijer <sjoerd.meijer@arm.com>
Mon, 20 Jan 2020 09:01:34 +0000 (09:01 +0000)
committerSjoerd Meijer <sjoerd.meijer@arm.com>
Mon, 20 Jan 2020 09:05:00 +0000 (09:05 +0000)
commit93175a5caa08360ca60b417cc04c094e1ed05c76
treec277c46d0f8f5096b31bac17156ddf9b79f16056
parent854f7be20a0cb1a95671a16d6cc8200107ee25f4
[IndVarSimplify][LoopUtils] rewriteLoopExitValues. NFCI

This moves `rewriteLoopExitValues()` from IndVarSimplify to LoopUtils thus
making it a generic loop utility function.  This allows to rewrite loop exit
values by just calling this function without running the whole IndVarSimplify
pass.

We use this in D72714 to rematerialise the iteration count in exit blocks, so
that we can clean-up loop update expressions inside the hardware-loops later.

Differential Revision: https://reviews.llvm.org/D72602
llvm/include/llvm/Transforms/Utils/LoopUtils.h
llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
llvm/lib/Transforms/Utils/LoopUtils.cpp