summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2015-11-12 18:10:22 -0800
committerEmil Velikov <emil.l.velikov@gmail.com>2015-11-18 18:58:53 +0000
commit0dd0d6696fd7760f460af87f7155ce2ae6316945 (patch)
tree70ab140c33dcd64f258f60c97ad99357369b00ba
parent4b3d4ceaba7fff20938c76961075d2bce6469b8d (diff)
nir/vars_to_ssa: Rework copy set handling in lower_copies_to_load_store
Previously, we walked through a given deref_node's copies and, after lowering the copy away, removed it from both the source and destination copy sets. This commit changes this to only remove it from the other node's copy set (not the one we're lowering). At the end of the loop, we just throw away the copy set for the node we're lowering since that node no longer has any copies. This has two advantages: 1) It's more efficient because we're doing potentially half as many set search operations. 2) It now properly handles copies from a node to itself. Perviously, it would delete the copy from the set when processing the destinatioon and then assert-fail when we couldn't find it for the source. Cc: "11.0" <mesa-stable@lists.freedesktop.org> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92588 Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com> Reviewed-by: Connor Abbott <cwabbott0@gmail.com> (cherry picked from commit 226ba889a0f820b9f4b1132e379620d2688c96e7)
-rw-r--r--src/glsl/nir/nir_lower_vars_to_ssa.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/glsl/nir/nir_lower_vars_to_ssa.c b/src/glsl/nir/nir_lower_vars_to_ssa.c
index ccb8f99dfba..1248926ffd2 100644
--- a/src/glsl/nir/nir_lower_vars_to_ssa.c
+++ b/src/glsl/nir/nir_lower_vars_to_ssa.c
@@ -455,7 +455,8 @@ lower_copies_to_load_store(struct deref_node *node,
struct deref_node *arg_node =
get_deref_node(copy->variables[i], state);
- if (arg_node == NULL)
+ /* Only bother removing copy entries for other nodes */
+ if (arg_node == NULL || arg_node == node)
continue;
struct set_entry *arg_entry = _mesa_set_search(arg_node->copies, copy);
@@ -466,6 +467,8 @@ lower_copies_to_load_store(struct deref_node *node,
nir_instr_remove(&copy->instr);
}
+ node->copies = NULL;
+
return true;
}