glsl: Fix unroll of do{} while(false) like loops
authorDanylo Piliaiev <danylo.piliaiev@globallogic.com>
Thu, 22 Aug 2019 10:32:50 +0000 (13:32 +0300)
committerTimothy Arceri <tarceri@itsqueeze.com>
Fri, 6 Sep 2019 10:27:33 +0000 (10:27 +0000)
commitaabde02f2f1870668200cdf731d162911705b311
treed2ace3d8d7c7077df425dcb975684e10861da965
parent3debd0ef157ed614522d20c1735c38af42fcce30
glsl: Fix unroll of do{} while(false) like loops

For loops which condition is false on the first iteration
iteration count was falsely calculated under the assumption
that loop's condition is true until it becomes false, meaning
it's true at least one time.
Now such loops are reported as having 0 iteration.

Similar to the fix e71fc7f2 done in NIR.

Fixes tests/shaders/glsl-fs-loop-while-false-02.shader_test

Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/compiler/glsl/loop_analysis.cpp
src/compiler/glsl/loop_unroll.cpp