<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 21, 2016 at 8:40 AM, Aditya Kumar via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">hiraditya created this revision.<br>
hiraditya added reviewers: hfinkel, sanjoy.<br>
hiraditya added subscribers: mzolotukhin, sebpop, jlebar, llvm-commits.<br>
Herald added a subscriber: sanjoy.<br>
<br>
This patch implements Loop Rotation Pass:<br>
<br>
 1. Canonicalize loop latch to have only one successor.<br>
 2. Clone all the BBs which are exiting the loop.<br>
 3. Adjust phi of cloned BBs<br>
 4. Add phi to the new loop header<br>
 5. Update DOM<br>
<br>
With this patch all the basic blocks which are exiting the loop can be copied during rotation. This is helpful for passes like gvn/licm which can now remove loop invariant code<br>
because some computations (which might not dominate all the basic blocks of loop) can now be PRE'd as they are available outside of the loop (due to loop rotation).<br></blockquote><div><br>Can you give specific examples?</div><div><br>If these are simply bad choices our PRE makes, we can just fix PRE instead of rotate loops to fix PRE :)<br></div></div></div></div>