<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-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"
cite="mid:CAE9JR_OgzCVtzPc6aEUMvjYuSYy6LEExUPbQEmeef6tLL8Ocgg@mail.gmail.com">
<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"
moz-do-not-send="true">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
class="">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 class=""><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="HOEnZb"><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="moz-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>
</body>
</html>