<div>                Thanks a lot Johannes,<br><br>I'm looking into it!<br>            </div>            <div class="yahoo_quoted" style="margin:10px 0px 0px 0.8ex;border-left:1px solid #ccc;padding-left:1ex;">                        <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">                                <div>                    On Wednesday, July 1, 2020, 07:13:33 PM EDT, Johannes Doerfert <johannesdoerfert@gmail.com> wrote:                </div>                <div><br></div>                <div><br></div>                <div><div id="yiv8629892483"><div>    <p><font face="Hack Nerd Font Mono">In the case below you probably        don't need to split much.</font></p>    <p><font face="Hack Nerd Font Mono">It might be more complicated if        the two loops share edges, i.a.,</font></p>    <p><font face="Hack Nerd Font Mono"><br clear="none">      </font></p>    <p><font face="Hack Nerd Font Mono">```<br clear="none">      </font></p>    <p><font face="Hack Nerd Font Mono">for (...) {<br clear="none">      </font></p>    <p><font face="Hack Nerd Font Mono">  for (...) {<br clear="none">      </font></p>    <p><font face="Hack Nerd Font Mono">    if (...)</font></p>    <p><font face="Hack Nerd Font Mono">      return;</font></p>    <p><font face="Hack Nerd Font Mono">  }</font></p>    <p><font face="Hack Nerd Font Mono">}</font></p>    <p><font face="Hack Nerd Font Mono">```</font></p>    <p><font face="Hack Nerd Font Mono"><br clear="none">      </font></p>    <p><font face="Hack Nerd Font Mono">I guess the trick is to isolate        the inner loop properly so that extraction becomes trivial.</font></p>    <p><font face="Hack Nerd Font Mono">If you for example make sure        there is a single "entering" edge (from outside the loop to the        header),</font></p>    <p><font face="Hack Nerd Font Mono"> and a single "exiting" edge        (from the loop to a block not in the loop), outlining can be        done with</font></p>    <p><font face="Hack Nerd Font Mono">the code extractor for blocks we        already have. (Unclear about updating analyses though).</font></p>    <p><font face="Hack Nerd Font Mono"><br clear="none">      </font></p>    <p><font face="Hack Nerd Font Mono"><br clear="none">      </font></p>    <p><font face="Hack Nerd Font Mono"><br clear="none">      </font></p>    <p><font face="Hack Nerd Font Mono"></font><br clear="none">    </p>    <div class="yiv8629892483yqt8239894258" id="yiv8629892483yqt02298"><div class="yiv8629892483moz-cite-prefix">On 7/1/20 5:36 PM, iulian brumar wrote:<br clear="none">    </div>    <blockquote type="cite">      <pre class="yiv8629892483moz-quote-pre"> Hi Johannes,This is very helpful and thank you for the quick response.I imagine that the usual nested loop structure is something like:loop1_header_bbbbs_between_loop1_header_and_loop2_headerloop2_header_bbloop_body_bbsbr loop2_header_bbinstructions_before_loop1_end_and_after_loop2_endbr loop1_header_bbIn this case you mean that loop2_header_bb might need to be split before extracting loop 2 into its own function? I'm not sure yet about how to use bb splitting to enable inner-loop extraction and what splitting edges means.Sincerely, Iulian     On Wednesday, July 1, 2020, 06:06:01 PM EDT, Johannes Doerfert <a rel="nofollow" shape="rect" class="yiv8629892483moz-txt-link-rfc2396E" ymailto="mailto:johannesdoerfert@gmail.com" target="_blank" href="mailto:johannesdoerfert@gmail.com"><johannesdoerfert@gmail.com></a> wrote:     Hi Iulian,   On first thought I would think that extracting top-level loops is only minimally easier than extracting any other loop level, if you consider arbitrary input, e.g,. potential irreducible "outer-outer-most" loops. For inner ones you might want to split  some blocks and edges to make sure they are not shared with the outer loop but other than that, I imagine it to be pretty similar.  (This assumes you do not want to preserve things like LoopInfo, ScalarEvolution, ...).   Extracting a single basic block is probably easier still. Again, assuming you do not want to update analyses.   If you want more details or think I haven't grasped the essence of your questions, feel free to say so :)    ~ Johannes     On 7/1/20 4:23 PM, iulian brumar via llvm-dev wrote:   Hello everyone,Quick question about loop extraction in llvm. I've been using the LoopExtractor pass in llvm/lib/Transforms/IPO/LoopExtractor.cpp to extract top level loops from programs.I'm wondering if extracting inner-most loops is any more complex than using the BlockExtractor pass in llvm/lib/Transforms/IPO/BlockExtractor.cpp and making sure that the basic blocks in the extracted region are single entry-single exit. Would there be any fundamental differences wrt what LoopExtractor is doing for top-level loops?Thanks,Iulian_______________________________________________LLVM Developers mailing <a rel="nofollow" shape="rect" class="yiv8629892483moz-txt-link-abbreviated" ymailto="mailto:listllvm-dev@lists.llvm.orghttps://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank" href="mailto:listllvm-dev@lists.llvm.orghttps://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">listllvm-dev@lists.llvm.orghttps://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>    </pre>    </blockquote></div>  </div></div></div>            </div>                </div>