[PATCH] D13974: [IndVarSimplify] Rewrite loop exit values with their initial values from loop preheader

Chen Li via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 22 00:06:01 PDT 2015


chenli created this revision.
chenli added a reviewer: sanjoy.
chenli added a subscriber: llvm-commits.

This patch adds support to check if a loop has loop invariant conditions which lead to loop exits. If so, we know that if the exit path is taken, it is at the first loop iteration. If there is an induction variable used in that exit path whose value has not been updated, it will keep its initial value passing from loop preheader. We can therefore rewrite the exit value with
its initial value. This will help remove phis created by LCSSA and enable other optimizations like loop unswitch.


http://reviews.llvm.org/D13974

Files:
  lib/Transforms/Scalar/IndVarSimplify.cpp
  test/Transforms/IndVarSimplify/rewrite-loop-exit-value.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13974.38095.patch
Type: text/x-patch
Size: 6349 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151022/885b5fbd/attachment.bin>


More information about the llvm-commits mailing list