diff options
author | Timothy Arceri <[email protected]> | 2018-07-11 10:50:16 +1000 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2018-08-29 16:02:05 +1000 |
commit | 0f450b57a1c056043952d24f97348eb2fc8b4ba7 (patch) | |
tree | ef4ad1ca02c41439108929edfa90280c4a7f5d64 /src/compiler | |
parent | 5a6b04d94bd2ec175d485b71e8ae815efd778a8a (diff) |
nir/opt_loop_unroll: Remove unneeded phis if we make progress
Now that SSA values can be derefs and they have special rules, we have
to be a bit more careful about our LCSSA phis. In particular, we need
to clean up in case LCSSA ended up creating a phi node for a deref.
This avoids validation issues with some CTS tests with the following
patch, but its possible this we could also see the same problem with
the existing unrolling passes.
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/nir/nir_opt_loop_unroll.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/compiler/nir/nir_opt_loop_unroll.c b/src/compiler/nir/nir_opt_loop_unroll.c index a1ad0e59814..e0e0b754716 100644 --- a/src/compiler/nir/nir_opt_loop_unroll.c +++ b/src/compiler/nir/nir_opt_loop_unroll.c @@ -575,9 +575,17 @@ 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; } |