https://bugs.freedesktop.org/show_bug.cgi?id=32211

--- Comment #14 from Danylo <danylo.pilia...@gmail.com> ---
(In reply to Timothy Arceri from comment #13)
> 
> 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?

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

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

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to