<div dir="ltr">(Sorry for repeat mail for some, forgot to fix the mailing list address)<br><br><div class="gmail_quote"><div dir="ltr">On Mon, Feb 16, 2015 at 11:04 AM James Molloy <<a href="mailto:james.molloy@arm.com">james.molloy@arm.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: jamesm<br>
Date: Mon Feb 16 12:59:54 2015<br>
New Revision: 229419<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=229419&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=229419&view=rev</a><br>
Log:<br>
Run LICM as part of the cleanup phase from the scalar optimizer.<br>
<br>
Things like LoopUnrolling can produce loop invariant values - make sure<br>
we pick them up.<br></blockquote><div><br></div><div class="uyb8Gf" style="font-size:13px;line-height:19.5px"><div class="F3hlO"><div dir="ltr"><div class="gmail_quote"><div>Sorry for the commit archaeology, but this patch really doesn't make sense to me.</div><div><br></div><div>In order to do this, we have to re-canonicalize all the loops and build a new loop pass manager to do LICM and nothing other than LICM. Notably, we don't do any of the other obvious loop passes afterward like loop deletion.</div><div><br></div><div>The explanation also doesn't completely make sense to me because of how the loop pass pipeline works. When we unroll an inner loop, we should start the loop pass pipeline again on the outer loop, which should allow LICM to see the suddenly invariant values.</div><div><br></div><div>I think that you may have been trying to fix symptoms of the loop pass pipeline being split up by function passes as described in PR24804. If that's the case, the fix really isn't to add a late LICM run, but to get the loop pass pipeline to be cohesive and complete.</div><div><br></div><div>And if we need to have two loop pass pipelines, we really need each of them to be "complete" loop optimization pipelines, including rotation, LICM, deletion, and unrolling (likely in that exact order).</div></div></div></div></div><div><br></div><div>What do folks think? I'm about to land a test that should also make it more clear what the structure of the pass pipeline happens to be. Enhancements there would be welcome.</div><div><br></div><div>Also, it would be great to have functional test cases for what this catches James... Is there any hope of crafting one?</div><div><br></div><div>-Chandler</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Modified:<br>
    llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp<br>
<br>
Modified: llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp?rev=229419&r1=229418&r2=229419&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp?rev=229419&r1=229418&r2=229419&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp Mon Feb 16 12:59:54 2015<br>
@@ -259,6 +259,7 @@ void PassManagerBuilder::populateModuleP<br>
   MPM.add(createJumpThreadingPass());         // Thread jumps<br>
   MPM.add(createCorrelatedValuePropagationPass());<br>
   MPM.add(createDeadStoreEliminationPass());  // Delete dead stores<br>
+  MPM.add(createLICMPass());<br>
<br>
   addExtensionsToPM(EP_ScalarOptimizerLate, MPM);<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div>