On 23 March 2012 14:16, Jose Fonseca <span dir="ltr">&lt;<a href="mailto:jfonseca@vmware.com">jfonseca@vmware.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">----- Original Message -----<br>
&gt; On 03/23/2012 03:49 AM, Kenneth Graunke wrote:<br>
&gt; &gt; On 03/23/2012 12:03 AM, Jose Fonseca wrote:<br>
&gt; &gt; [snip]<br>
&gt; &gt;&gt;&gt; Ian,<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt; The loop analysis code currently doesn&#39;t take calls into account<br>
&gt; &gt;&gt;&gt; whatsoever, which is clearly wrong. Any ideas on the best way to<br>
&gt; &gt;&gt;&gt; fix<br>
&gt; &gt;&gt;&gt; it?<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; I think that, before a loop is unrolled, any inner calls should be<br>
&gt; &gt;&gt; inlined. I don&#39;t any correctness/performance reason to do any<br>
&gt; &gt;&gt; differently.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; Jose<br>
&gt; &gt;<br>
&gt; &gt; Yeah, I think &quot;don&#39;t unroll if there are function calls&quot; is the<br>
&gt; &gt; right<br>
&gt; &gt; answer. Inlining first would make unrolling happen in most cases.<br>
&gt; &gt; We can<br>
&gt; &gt; always improve on that later.<br>
&gt;<br>
&gt; I don&#39;t think we have to go that far.  I think:<br>
&gt;<br>
&gt; 1. Mark any out or inout parameter as being assigned (in the loop).<br>
&gt; 2. Mark any globals as being assigned.<br>
&gt;<br>
&gt; That should put a bandaid on it.<br>
<br>
</div>Sounds a perfectly good bandaid.<br>
<br>
But I guess I still don&#39;t understand why we&#39;d ever want to unroll a loop that contain function calls. If the call is not worth to inline, then what&#39;s the point of unrolling the loop?<br></blockquote><div><br>
Yeah, I agree.  In any case, it&#39;s a moot point for now because Mesa currently inlines everything no matter what.<br><br>As for the bandaid, is there a benefit of doing it rather than the &quot;proper fix&quot; of disabling loop unrolling for loops containing function calls?  In this case the proper fix seems easier, so I&#39;m not sure why we&#39;re considering a bandaid.<br>
</div></div>