nir/lower_goto_ifs: Don't destroy SSA form in the process
There are two issues here:
1. If there are any phi nodes, we'll make complete hash of them. This
isn't likely actually a problem because spirv_to_nir doesn't
generate any actual phi nodes today. However, if we start doing any
other passes before this, we may have a problem.
2. Even without phi nodes, we may still break SSA form. This can
happen if we ever have to stick a block inside a conditional to
satisfy weird CFG constraints. Doing so can cause it to no longer
look like it dominates some of its uses even though, at runtime,
it's guaranteed to be run first.
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6750>
This commit is contained in:
committed by
Marge Bot
parent
6f134a622b
commit
b6a4172f10
@@ -957,6 +957,12 @@ nir_lower_goto_ifs_impl(nir_function_impl *impl)
|
||||
|
||||
nir_metadata_require(impl, nir_metadata_dominance);
|
||||
|
||||
/* We're going to re-arrange blocks like crazy. This is much easier to do
|
||||
* if we don't have any phi nodes to fix up.
|
||||
*/
|
||||
nir_foreach_block_unstructured(block, impl)
|
||||
nir_lower_phis_to_regs_block(block);
|
||||
|
||||
nir_cf_list cf_list;
|
||||
nir_cf_extract(&cf_list, nir_before_cf_list(&impl->body),
|
||||
nir_after_cf_list(&impl->body));
|
||||
@@ -997,6 +1003,9 @@ nir_lower_goto_ifs_impl(nir_function_impl *impl)
|
||||
|
||||
nir_metadata_preserve(impl, nir_metadata_none);
|
||||
|
||||
nir_repair_ssa_impl(impl);
|
||||
nir_lower_regs_to_ssa_impl(impl);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user