<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jun 5, 2012, at 3:20 AM, Martin Apel <<a href="mailto:martin.apel@SIMPACK.de">martin.apel@SIMPACK.de</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div bgcolor="#FFFFFF" text="#000000">
<div class="moz-signature"><font color="#330033">I am trying to
implement loop unrolling in a context, where lots of constant
propagation has taken place.<br>
Unrolling an outer loop might make an inner loop have constant
bounds, therefore I want to process the loops<br>
outside in, i.e. from parent loops to nested loops.<br>
Unfortunately the standard loop pass manager performs loop
passes inside out, i.e. from nested loops to parent loops,<br>
thereby missing optimization opportunities in my case.<br>
<br>
I haven't found a way how to implement this on my own. I tried
implementing a function pass, where I could process the<br>
loops outside in. Unfortunately I cannot use the UnrollLoop
utility function in this case, which crashes, when called with a
<br>
NULL LPPassManager object, despite opposite documentation.<br>
<br>
Is there any way how to process loops outside in still using the
UnrollLoop function?<br></font></div></div></blockquote></div><div><br></div>I noticed another case of referencing LPM without a null check and fixed it here r158007.<div><br></div><div>You'll should be careful to check everything that's currently disabled when LPM is missing: domtree update, ScalarEvolution update, SimplifyIndvar. If you need any of these things I suggest changing the interface.</div><div><br></div><div>Maybe it would work to pass in FunctionPass instead of LPM. In the one place we actually need an LPM (deleteLoopFromQueue), we could check FunctionPass's type and cast. Maybe getAsPMDataManager()->getPassManagerType() == PMT_LoopPassManager?</div><div><br></div><div>-Andy</div></body></html>