<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>On Sat, 2016-09-17 at 09:40 +1000, Timothy Arceri wrote:</div><blockquote type="cite"><div>On Fri, 2016-09-16 at 15:25 -0700, Jason Ekstrand wrote:</div><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Sep 15, 2016 at 12:03 AM, Timothy Arceri <span dir="ltr"><<a href="mailto:timothy.arceri@collabora.com" target="_blank">timothy.arceri@collabora.com</a>></span> wrote:<br><blockquote type="cite">From: Thomas Helland <<a href="thomashelland90@gmail.com>" target="_blank">thomashelland90@gmail.com></a><br></blockquote></div></div></div></blockquote></blockquote><div><br></div><div>snip</div><div><br></div><blockquote type="cite"><div><br></div><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> </div><blockquote type="cite">
+ return -1;<br>
+<br>
+ /* do-while loops can increment the starting value before the condition is<br>
+ * checked. e.g.<br>
+ *<br>
+ * do {<br>
+ * ndx++;<br>
+ * } while (ndx < 3);<br>
+ *<br>
+ * Here we check if the induction variable is used directly by the loop<br>
+ * condition and if so we assume we need to step the initial value.<br>
+ */<br>
+ bool increment_before = false;<br>
+ if (cond_alu->src[0].src.ssa == alu_def->def ||<br>
+ cond_alu->src[1].src.ssa == alu_def->def) {<br>
+ increment_before = true;<br></blockquote><div><br></div><div>Is there a reason why this can't be handled as "trip_count + 1"? This seems way overcomplicated.<br></div></div></div></div></blockquote><div><br></div><div>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.</div><div>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.</div><div><br></div></blockquote><div>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.</div></body></html>