nir/opt_if: Remove open-coded nir_ssa_def_rewrite_uses()

So that we don't have to change these two places later.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6866>
This commit is contained in:
Connor Abbott 2019-04-16 19:31:45 +02:00 committed by Marge Bot
parent c6f871b62e
commit 656e428ff4
1 changed files with 2 additions and 18 deletions

View File

@ -493,16 +493,8 @@ opt_split_alu_of_phi(nir_builder *b, nir_loop *loop)
/* Modify all readers of the original ALU instruction to read the
* result of the phi.
*/
nir_foreach_use_safe(use_src, &alu->dest.dest.ssa) {
nir_instr_rewrite_src(use_src->parent_instr,
use_src,
nir_ssa_def_rewrite_uses(&alu->dest.dest.ssa,
nir_src_for_ssa(&phi->dest.ssa));
}
nir_foreach_if_use_safe(use_src, &alu->dest.dest.ssa) {
nir_if_rewrite_condition(use_src->parent_if,
nir_src_for_ssa(&phi->dest.ssa));
}
/* Since the original ALU instruction no longer has any readers, just
* remove it.
@ -713,16 +705,8 @@ opt_simplify_bcsel_of_phi(nir_builder *b, nir_loop *loop)
/* Modify all readers of the bcsel instruction to read the result of
* the phi.
*/
nir_foreach_use_safe(use_src, &bcsel->dest.dest.ssa) {
nir_instr_rewrite_src(use_src->parent_instr,
use_src,
nir_ssa_def_rewrite_uses(&bcsel->dest.dest.ssa,
nir_src_for_ssa(&phi->dest.ssa));
}
nir_foreach_if_use_safe(use_src, &bcsel->dest.dest.ssa) {
nir_if_rewrite_condition(use_src->parent_if,
nir_src_for_ssa(&phi->dest.ssa));
}
/* Since the original bcsel instruction no longer has any readers,
* just remove it.