<div dir="ltr">Hi all,<div><br></div><div>Attached herewith is a simple vectorized function with loops performing a simple shuffle.</div><div><br></div><div>I want all loops (inner and outer) to be unrolled by 2 and as such used -unroll-count=2</div><div>The inner loops(with k as the induction variable and having constant trip counts) unroll fully, but the outer loop with (j) fails to unroll. </div><div><br></div><div>The llvm code is also attached with inner loops fully unrolled.</div><div><br></div><div>To inspect further, I added the following to the PassManagerBuilder.cpp to run some canonicalization routines and redo unrolling again. I have set partial unrolling on + have a huge threshold + allows expensive loop trip counts. Still it didn't unroll by 2.</div><div><br></div><div><p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">MPM.add(createLoopUnrollPass());</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">MPM.add(createCFGSimplificationPass()); </span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">MPM.add(createLoopSimplifyPass()); </span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">MPM.add(createLoopRotatePass(SizeLevel == </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(39,42,216)">2</span><span style="font-variant-ligatures:no-common-ligatures"> ? </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(39,42,216)">0</span><span style="font-variant-ligatures:no-common-ligatures"> : -</span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(39,42,216)">1</span><span style="font-variant-ligatures:no-common-ligatures">));</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">MPM.add(createLCSSAPass());</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">MPM.add(createIndVarSimplifyPass());        </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,132,0)">// Canonicalize indvars</span></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:menlo"><span style="font-variant-ligatures:no-common-ligatures">MPM.add(createLoopUnrollPass());</span></p></div><div><br></div><div><br></div><div>Digging deeper I found, that it fails in UnrollRuntimeLoopRemainder function, where it is unable to calculate the BackEdge taken amount.</div><div><br></div><div>Can anybody explain what is need to get the outer loop unrolled by 2? It would be a great help.</div><div><br></div><div>Thanks.</div><div>-- <br><div class="gmail_signature"><div dir="ltr"><div>Kind regards,<br>Charith Mendis<br><br>Graduate Student,<div>CSAIL,<br><div>Massachusetts Institute of Technology</div></div></div></div></div>
</div></div>