<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Andy,<br>
    <br>
    sorry, my mail wasn't precise enough: I am trying to do this in a
    plugin, i.e. in a LLVM client. I try to do this without modifying<br>
    LLVM itself. In the meantime I have found a way to do it the way I
    need it. I only consider top-level loops in my LoopPass<br>
    and add the child loops again using
    LPPassManager::insertLoopIntoQueue. This seems to have the desired
    effect.<br>
    <br>
    Martin<br>
    <br>
    <div class="moz-cite-prefix">On 05/06/12 20:11, Andrew Trick wrote:<br>
    </div>
    <blockquote
      cite="mid:9D266342-EDD8-4408-B5EF-0BFED214A57C@apple.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <br>
      <div>
        <div>On Jun 5, 2012, at 3:20 AM, Martin Apel <<a
            moz-do-not-send="true" 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=ISO-8859-1">
          <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>
    </blockquote>
    <br>
  </body>
</html>