[Mesa-dev] [PATCH 02/10] nir: Add a loop analysis pass

Timothy Arceri timothy.arceri at collabora.com
Sat Sep 17 00:09:02 UTC 2016


On Sat, 2016-09-17 at 09:40 +1000, Timothy Arceri wrote:
> On Fri, 2016-09-16 at 15:25 -0700, Jason Ekstrand wrote:
> > > > On Thu, Sep 15, 2016 at 12:03 AM, Timothy Arceri <timothy.arceri at co
llabora.com> wrote:
> > > > > > From: Thomas Helland <thomashelland90 at gmail.com>
> > 
> > 

snip

> 
> >  
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > 
+      return -1;

+

+   /* do-while loops can increment the starting value before the condition is

+    * checked. e.g.

+    *

+    *    do {

+    *        ndx++;

+    *     } while (ndx < 3);

+    *

+    * Here we check if the induction variable is used directly by the loop

+    * condition and if so we assume we need to step the initial value.

+    */

+   bool increment_before = false;

+   if (cond_alu->src[0].src.ssa == alu_def->def ||

+       cond_alu->src[1].src.ssa == alu_def->def) {

+      increment_before = true;
> > 
> > Is there a reason why this can't be handled as "trip_count + 1"?  This seems way overcomplicated.
> 
> Yes there is. We don't know that we will increment by 1 it could be by 10, also if we support more opts we may have to do a mul etc.
> We could set the initial value here but I decided to keep it all in get_iteration() I guess I could move this logic there also.
> 
Ingonre that I see what you are getting at but it would be trip_count -
1. That should be ok if sub is lowered as you say.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160917/2024418b/attachment.html>


More information about the mesa-dev mailing list