diff options
author | Jason Ekstrand <[email protected]> | 2018-09-11 12:51:09 -0500 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-09-19 01:59:40 -0500 |
commit | 0796c3934ebfe3448acf2d63f478f51c08e33046 (patch) | |
tree | 810f7deb506d3b3ccfd776743f9c2b00cc43ca2e /src | |
parent | 7d1d1208c2b38890fe065b6431ef2e3b7166bae4 (diff) |
nir/loop_unroll: Re-materialize derefs in use blocks before unrolling
When we're about to re-arrange a bunch of blocks, it's a good idea to
make sure that we don't have deref uses crossing block boundaries.
Otherwise we may end up with a deref going through a phi and that would
be bad.
Reviewed-by: Iago Toral Quiroga <[email protected]>
Cc: "18.2" <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/nir/nir_opt_loop_unroll.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/compiler/nir/nir_opt_loop_unroll.c b/src/compiler/nir/nir_opt_loop_unroll.c index 0ba150f1264..ea2012e292a 100644 --- a/src/compiler/nir/nir_opt_loop_unroll.c +++ b/src/compiler/nir/nir_opt_loop_unroll.c @@ -49,6 +49,9 @@ static void loop_prepare_for_unroll(nir_loop *loop) { + nir_rematerialize_derefs_in_use_blocks_impl( + nir_cf_node_get_function(&loop->cf_node)); + nir_convert_loop_to_lcssa(loop); /* Lower phis at the top level of the loop body */ @@ -691,17 +694,9 @@ nir_opt_loop_unroll_impl(nir_function_impl *impl, &has_nested_loop); } - if (progress) { + if (progress) nir_lower_regs_to_ssa_impl(impl); - /* Calling nir_convert_loop_to_lcssa() adds extra phi nodes which may - * not be valid if they're used for something such as a deref. - * Remove any unneeded phis. - */ - nir_copy_prop(impl->function->shader); - nir_opt_remove_phis_impl(impl); - } - return progress; } |