<div dir="auto">I do not think we have this framework of conditionally kicking in analysis passes. But one can always do "intelligent" prior setting of attribute over function which can be checked in getAnalysisUsage for a perticular pass to conditionally enable needed analysis.<div dir="auto"><br></div><div dir="auto">Cheers</div><div dir="auto"><div dir="auto">Jatin </div><div dir="auto"><div dir="auto"><br><div class="gmail_quote"><div dir="ltr">On Tue, 24 Apr 2018, 04:33 Friedman, Eli via llvm-dev, <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <div class="m_2643682578738763853moz-cite-prefix">I probably wouldn't worry about the
      cost of LoopInfo; it's relatively cheap to compute.  But if you're
      really concerned, you can run your pass after a pass which
      preserves LoopInfo (so it's free because it was already
      computed).  Or you can stick your code into an existing pass which
      requires LoopInfo anyway, like LoopIdiomRecognize.<br>
      <br>
      -Eli<br>
      <br>
      On 4/23/2018 3:37 PM, Anom LLVM wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">Thanks for the answer Eli.
        <div><br>
        </div>
        <div>I think I was a little too vague in my question. The
          program has the following structure:</div>
        <div>void foo() {</div>
        <div>  bar();<br>
          }</div>
        <div><br>
        </div>
        <div>void bar() {</div>
        <div>  for (..) {</div>
        <div>       __builtin_compute()</div>
        <div>  }</div>
        <div>}</div>
        <div><br>
        </div>
        <div>We would like to use scalar evolution + loopinfowrapperpass
          inside instcombine only if __builtin_compute is present.
          instcombine can convert the loop into a single builtin ie.</div>
        <div><br>
        </div>
        <div>void bar() {</div>
        <div>  __builtin_wide_compute();</div>
        <div>}</div>
        <div><br>
        </div>
        <div>When the inliner runs on foo(), we want bar() to already
          have the transformation to reflect the cost of the inlining
          decision more accurately. </div>
        <div><br>
        </div>
        <div>I do see that scalar evolution is a lazy but
          loopwrapinfopass is not. Is there a way to run these two
          analysis passes conditionally before inlining?</div>
        <div><br>
        </div>
        <div>Thanks,</div>
        <div><br>
        </div>
        <div>Stan</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Fri, Apr 20, 2018 at 1:55 PM,
          Friedman, Eli <span dir="ltr"><<a href="mailto:efriedma@codeaurora.org" target="_blank" rel="noreferrer">efriedma@codeaurora.org</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On 4/19/2018 1:57 PM, Anom LLVM via llvm-dev
              wrote:<br>
              <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                Hi,<br>
                <br>
                I have pass phase ordering question.<br>
                <br>
                I am interested in performing a transformation that
                matches several LLVM IR instructions and converts them
                to a single builtin. This sort of transformation must
                occur prior to inlining because inlining needs to
                analyze cost of the builtin. However, the LLVM IR ->
                builtin transformation requires scalar evolution which
                typically doesn't run until after the inliner.<br>
              </blockquote>
              <br>
            </span>
            This isn't right, or at least, not the complete picture;
            loop optimization passes run interleaved with the inliner. 
            (Try looking at the output of "-debug-pass=Executions" to
            see exactly what's happening.)<span><br>
              <br>
              <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                My question is, is there a way to run scalar evolution
                conditionally prior to inlining? I'd like to leave
                compile time unaffected if my code doesn't contain any
                of these builtins.<br>
              </blockquote>
              <br>
            </span>
            ScalarEvolution is lazy, so it's essentially free if you
            don't query it.<span class="m_2643682578738763853HOEnZb"><font color="#888888"><br>
                <br>
                -Eli<br>
                <br>
                -- <br>
                Employee of Qualcomm Innovation Center, Inc.<br>
                Qualcomm Innovation Center, Inc. is a member of Code
                Aurora Forum, a Linux Foundation Collaborative Project<br>
                <br>
              </font></span></blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <p><br>
    </p>
    <pre class="m_2643682578738763853moz-signature" cols="72">-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project</pre>
  </div>

_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" rel="noreferrer">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div></div></div></div></div>