[Mesa-dev] [Bug 32211] [GLSL] lower_jumps with continue-statements in for-loops prevents loop unrolling
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Thu Nov 22 13:29:11 UTC 2018
https://bugs.freedesktop.org/show_bug.cgi?id=32211
--- Comment #14 from Danylo <danylo.piliaiev at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20181122/211a9694/attachment.html>
More information about the mesa-dev
mailing list