summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_phi_builder.h
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2016-08-24 19:25:58 -0700
committerMatt Turner <[email protected]>2016-08-25 13:45:39 -0700
commite53130cc27b966a09d48be53cb51e09ea7ad0649 (patch)
tree8e916256d605c40e31a535c069442fcf1272f5f1 /src/compiler/nir/nir_phi_builder.h
parenta491b9e945423a81f785220b85a9b395060952aa (diff)
nir: Walk blocks in source code order in lower_vars_to_ssa.
Prior to this commit rename_variables_block() is recursively called, performing a depth-first traversal of the control flow graph. The function uses a non-trivial amount of stack space for local variables, which puts us in danger of smashing the stack, given a sufficiently deep dominance tree. XCOM: Enemy Within contains a shader with such a dominance tree (1574 nir_blocks in total, depth of at least 143). Jason tells me that he believes that any walk over the nir_blocks that respects dominance is sufficient (a DFS might have been necessary prior to the introduction of nir_phi_builder). In fact, the introduction of nir_phi_builder made the problem worse: rename_variables_block(), walks to the bottom of the dominance tree before calling nir_phi_builder_value_get_block_def() which walks back to the top of the dominance tree... In any case, this patch ensures we avoid that problem as well. Cc: [email protected] Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97225 Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_phi_builder.h')
-rw-r--r--src/compiler/nir/nir_phi_builder.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/compiler/nir/nir_phi_builder.h b/src/compiler/nir/nir_phi_builder.h
index edc530268c2..a4dc18a2b22 100644
--- a/src/compiler/nir/nir_phi_builder.h
+++ b/src/compiler/nir/nir_phi_builder.h
@@ -44,7 +44,8 @@
* var.pb_val = nir_phi_builder_add_value(pb, var.defs)
*
* // Visit each block. This needs to visit dominators first;
- * // nir_for_each_block() will be ok.
+ * // nir_foreach_block() will be ok.
+ *
* foreach block:
* foreach instruction:
* foreach use of variable var: