nir/lower_variables: Use a real dominance DFS for variable renaming
authorJason Ekstrand <jason.ekstrand@intel.com>
Mon, 15 Dec 2014 22:06:58 +0000 (14:06 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 15 Jan 2015 15:20:22 +0000 (07:20 -0800)
commitbc0735857f1f36eede7e8e5382f8e9bbc496fecb
treef326d0b1d361eba320d5735e5c558aaecd68ce85
parentdfb3abbaecfbe30b8858a5428c604f9d90f65505
nir/lower_variables: Use a real dominance DFS for variable renaming

Previously, we were just iterating over the program "in order" which
kind-of approximates a DFS, but not really.  In particular, we got the
following case wrong:

loop {
   a = 3;
   if (foo) {
      a = 5;
   } else {
      break;
   }
   use(a);
}

where use(a) would get 3 instead of 5 because of premature popping of the
SSA def stack.  Now, since we do an actaul DFS, we should evaluate use(a)
immediately after a = 5 and we should be ok.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
src/glsl/nir/nir_lower_variables.c