<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [GLSL] lower_jumps with continue-statements in for-loops prevents loop unrolling"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=32211#c14">Comment # 14</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [GLSL] lower_jumps with continue-statements in for-loops prevents loop unrolling"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=32211">bug 32211</a>
              from <span class="vcard"><a class="email" href="mailto:danylo.piliaiev@gmail.com" title="Danylo <danylo.piliaiev@gmail.com>"> <span class="fn">Danylo</span></a>
</span></b>
        <pre>(In reply to Timothy Arceri from <a href="show_bug.cgi?id=32211#c13">comment #13</a>)
<span class="quote">> 
> None of that should matter. If the continue if removed there should be
> nothing stopping the loop from unrolling, and if the loop is unrolled the
> both ifs should be able to be optimised away (assuming I'm reading the IR
> correctly). Is this not what you are seeing?</span >

Unfortunately not, loop isn't unrolled.

To be on the same page the optimization I did is turning

   loop {
       ...
       if (cond) {
          do_work_1();
          continue;
       } else {
       }
       do_work_2();
    }

into:

    loop {
       ...
       if (cond) {
          do_work_1();
       } else {
          do_work_2();
       }
    }

So in our case it effectively produces:

       ...
       if (cond) {
          i++;
          do_work_1();
       } else {
          i++;
          do_work_2();
       }
       ...

Looks like in previous comment I forgot to say that both branches have 'i++'.

Loop with such condition couldn't be unrolled because
'compute_induction_information' could not find induction variable because 'i'
is in a control flow

<span class="quote">> /* If one of the sources is in a conditional or nested block then
>  * panic.
>  */
> if (src_var->in_control_flow)
>    break;</span >

To make loop unrollable 'i++' should be outside of conditional block and there
is no optimization that could pull it out as I wrote in previous comment.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>