glsl: check if induction var incremented before use in terminator
authorTimothy Arceri <tarceri@itsqueeze.com>
Thu, 21 Sep 2017 03:55:56 +0000 (13:55 +1000)
committerTimothy Arceri <tarceri@itsqueeze.com>
Mon, 9 Oct 2017 23:05:37 +0000 (10:05 +1100)
commitd24e16fe1f63d8f666dd57cfddf8340d439b391a
tree12f1fb8a784408c265252629832509782c72cb55
parentab23b759f241a4e2247efa28bd28a5f20149c70b
glsl: check if induction var incremented before use in terminator

do-while loops can increment the starting value before the
condition is checked. e.g.

  do {
    ndx++;
  } while (ndx < 3);

This commit changes the code to detect this and reduces the
iteration count by 1 if found.

V2: fix terminator spelling

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Elie Tournier <elie.tournier@collabora.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
src/compiler/glsl/loop_analysis.cpp