glsl: Fix loop analysis of nested loops.
authorPaul Berry <stereotype441@gmail.com>
Thu, 28 Nov 2013 18:48:37 +0000 (10:48 -0800)
committerPaul Berry <stereotype441@gmail.com>
Mon, 9 Dec 2013 18:54:16 +0000 (10:54 -0800)
commit877db5a792df7f5971c1906a3677b066926b9832
tree250784f332ecf754b667012d4ffaa79784cd9ffc
parent2e060551bdfb3f5019f64696f268675a3550927c
glsl: Fix loop analysis of nested loops.

Previously, when visiting a variable dereference, loop analysis would
only consider its effect on the innermost enclosing loop.  As a
result, when encountering a loop like this:

    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        ...
        i = 2;
      }
    }

it would incorrectly conclude that the outer loop ran three times.

Fixes piglit test "vs-inner-loop-modifies-outer-loop-var.shader_test".

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/loop_analysis.cpp
src/glsl/loop_analysis.h