mesa/st/glsl_to_tgsi: Properly resolve life times simple if/else + use constructs
authorGert Wollny <gw.fossdev@gmail.com>
Tue, 5 Jun 2018 20:26:37 +0000 (22:26 +0200)
committerGert Wollny <gw.fossdev@gmail.com>
Sat, 11 Aug 2018 10:32:42 +0000 (12:32 +0200)
commitf40c9d02254cd26d2ff92e3f42825fcd7badad92
tree22191ec1a26b5c31d49fb95ab447a7a8cccee1e7
parent568bda2f2d3a3c1bef172563941d36d35a91b5b7
mesa/st/glsl_to_tgsi: Properly resolve life times simple if/else + use constructs

in constructs like below, currently the live range estimation extends the live range
of t unecessarily to the whole loop because it was not detected that t is
unconditional written and later read only in the "if (a)" scope.

  while (foo)  {
    ...
    if (a) {
       ...
       if (b)
         t = ...
       else
         t = ...
       x = t;
       ...
    }
     ...
  }

This patch adds a unit test for this case and corrects the minimal live range estimation
accordingly.

v4: update comments
Signed-off-by: Gert Wollny <gw.fossdev@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp
src/mesa/state_tracker/tests/test_glsl_to_tgsi_lifetime.cpp