[Mesa-dev] [PATCH 1/2] st/glsl_to_tgsi: be precise about merging scopes
Nicolai Hähnle
nhaehnle at gmail.com
Wed Sep 6 09:54:49 UTC 2017
From: Nicolai Hähnle <nicolai.haehnle at amd.com>
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.
---
src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp
index d984184e701..8ba1f5bb0be 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp
@@ -526,22 +526,22 @@ lifetime temp_comp_access::get_required_lifetime()
enclosing_scope_first_write = conditional->outermost_loop();
}
/* Evaluate the scope that is shared by all: required first write scope,
* required first read before write scope, and last read scope.
*/
const prog_scope *enclosing_scope = enclosing_scope_first_read;
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)) {
enclosing_scope = enclosing_scope->parent();
assert(enclosing_scope);
}
/* Propagate the last read scope to the target scope */
while (enclosing_scope->nesting_depth() < last_read_scope->nesting_depth()) {
/* If the read is in a loop and we have to move up the scope we need to
--
2.11.0
More information about the mesa-dev
mailing list