<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Mar 2, 2019 at 2:13 AM Fedor Sergeev <<a href="mailto:fedor.sergeev@azul.com">fedor.sergeev@azul.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF">
    On 3/2/19 2:38 AM, Hiroshi Yamauchi wrote:<br>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div dir="ltr">
          <div dir="ltr">
            <div dir="ltr">
              <div dir="ltr">
                <div dir="ltr">
                  <div dir="ltr">
                    <div dir="ltr">
                      <div dir="ltr"><br>
                        <div class="gmail_quote">
                          <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
                            <div bgcolor="#FFFFFF">
                              <blockquote type="cite">
                                <div dir="ltr">
                                  <div dir="ltr">
                                    <div> Conditional BFI<br>
                                      We could consider adding a
                                      conditional BFI analysis that is a
                                      wrapper around BFI and computes
                                      BFI only if profiles are available
                                      (either checking the module has
                                      profile summary or depend on the
                                      PSI.) With this, we wouldn’t need
                                      to conditionally build pass
                                      pipelines and may work for the new
                                      pass manager. But a similar
                                      wouldn’t work for the old pass
                                      manager because we cannot
                                      conditionally depend on an
                                      analysis under it.<br>
                                    </div>
                                  </div>
                                </div>
                              </blockquote>
                              There is LazyBlockFrequencyInfo.<br>
                              Not sure how well it fits this idea.<br>
                            </div>
                          </blockquote>
                          <div><br>
                          </div>
                          <div>
                            <div><font face="arial, helvetica, sans-serif">Good
                                point. LazyBlockFrequencyInfo seems
                                usable with the old pass manager (save
                                unnecessary BFI/BPI) and would work for
                                function passes. I think t</font><span style="font-family:arial,helvetica,sans-serif">he </span><span style="font-family:arial,helvetica,sans-serif">restriction still applies
                                - </span><span style="font-family:arial,helvetica,sans-serif">a
                                loop pass cannot still request
                                (outer-scope) BFI, lazy or not, new or
                                old (pass manager). </span></div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    You would need to explicitly require it (or/and add to
    LoopStandardAnalysisResult) and teach loop passes to preserve it.<br>
    Preserving LazyBFI might be as simple as resetting it all, yet the
    overall idea of this LAzyBFI thing seems to be more or<br>
    less duplicating what analysis managers are doing in new pass
    manager.<br>
    <br>
    Here is a comment from LazyBFI's header:<br>
      /// Note that it is expected that we wouldn't need this
    functionality for the<br>
      /// new PM since with the new PM, analyses are executed on demand.<br>
    <br>
    :)<br></div></blockquote><div><br></div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Yes, we could actually request LazyBFI from a loop pass under the old pass manager.</div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF">
    <br>
    regards,<br>
      Fedor.<br>
    <br>
    <blockquote type="cite">
      <div dir="ltr">
        <div dir="ltr">
          <div dir="ltr">
            <div dir="ltr">
              <div dir="ltr">
                <div dir="ltr">
                  <div dir="ltr">
                    <div dir="ltr">
                      <div dir="ltr">
                        <div class="gmail_quote">
                          <div>
                            <div><span style="font-family:arial,helvetica,sans-serif">Another
                                assumption is that </span><span style="font-family:arial,helvetica,sans-serif">it'd
                                be cheap and safe to unconditionally
                                depend on PSI or check the module's
                                profile summary.</span></div>
                          </div>
                          <div><br>
                          </div>
                          <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
                            <div bgcolor="#FFFFFF"> <br>
                              regards,<br>
                                Fedor.<br>
                              <br>
                              <blockquote type="cite">
                                <div dir="ltr">
                                  <div dir="ltr">
                                    <div><br>
                                      <br>
                                      [1] We cannot call
                                      AnalysisManager::getResult for an
                                      outer scope but only
                                      getCachedResult. Probably because
                                      of potential pipelining or
                                      concurrency issues.<br>
                                      [2] For example, potentially
                                      breaking up multiple pipelined
                                      loop passes and insert
                                      RequireAnalysisPass<BlockFrequencyAnalysis>
                                      in front of each of them.<br>
                                      [3] For example,
                                      -fprofile-instr-use and
                                      -fprofile-sample-use aren’t
                                      present in ThinLTO post link
                                      builds.<br>
                                      [4] For example, we could check
                                      whether the module has the profile
                                      summary metadata annotated when
                                      building pass pipelines but we
                                      don’t always pass the module down
                                      to the place where we build pass
                                      pipelines.<br>
                                      [5] By inserting
                                      RequireAnalysisPass<ProfileSummaryInfo>
                                      after the PGOInstrumentationUse
                                      and the SampleProfileLoaderPass
                                      passes (and around the
                                      PGOIndirectCallPromotion pass for
                                      the Thin LTO post link pipeline.)<br>
                                      [6] For example, the
                                      context-sensitive PGO<span class="gmail_default" style="font-family:arial,helvetica,sans-serif">.</span><br>
                                      [7] Directly calling its
                                      constructor along with the
                                      dependent analyses results, eg.
                                      the jump threading pass.</div>
                                  </div>
                                </div>
                                <br>
                                <fieldset class="gmail-m_7801686576961354645m_3084483561612773275gmail-m_5869029522365402437mimeAttachmentHeader"></fieldset>
                                <pre class="gmail-m_7801686576961354645m_3084483561612773275gmail-m_5869029522365402437moz-quote-pre">_______________________________________________
LLVM Developers mailing list
<a class="gmail-m_7801686576961354645m_3084483561612773275gmail-m_5869029522365402437moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>
<a class="gmail-m_7801686576961354645m_3084483561612773275gmail-m_5869029522365402437moz-txt-link-freetext" href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
                              </blockquote>
                              <br>
                            </div>
_______________________________________________<br>
                            LLVM Developers mailing list<br>
                            <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
                            <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
                          </blockquote>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </div>

</blockquote></div></div>