st/glsl_to_tgsi: be precise about merging scopes
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 6 Sep 2017 09:43:06 +0000 (11:43 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 13 Sep 2017 16:28:11 +0000 (18:28 +0200)
enclosing_scope already contains enclosing_scope_first_read.
What we really want to check here -- not for correctness, but
for speed -- is whether last_read_scope already contains
enclosing_scope.

Reviewed-By: Gert Wollny <gw.fossdev@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp

index 00ec7e749bdd495e7c2301b165399a697cf48aeb..c0c0aaa02f32c2a67a5aeeea7dc43200771a95dd 100644 (file)
@@ -540,8 +540,8 @@ lifetime temp_comp_access::get_required_lifetime()
    if (enclosing_scope_first_write->contains_range_of(*enclosing_scope))
       enclosing_scope = enclosing_scope_first_write;
 
-   if (enclosing_scope_first_read->contains_range_of(*enclosing_scope))
-      enclosing_scope = enclosing_scope_first_read;
+   if (last_read_scope->contains_range_of(*enclosing_scope))
+      enclosing_scope = last_read_scope;
 
    while (!enclosing_scope->contains_range_of(*enclosing_scope_first_write) ||
           !enclosing_scope->contains_range_of(*last_read_scope)) {