{
assert(def != new_ssa);
nir_foreach_use_including_if_safe(use_src, def) {
- if (use_src->is_if)
- nir_if_rewrite_condition_ssa(use_src->parent_if, use_src, new_ssa);
- else
- nir_instr_rewrite_src_ssa(use_src->parent_instr, use_src, new_ssa);
+ nir_src_rewrite_ssa(use_src, new_ssa);
}
}
return;
nir_foreach_use_including_if_safe(use_src, def) {
- if (use_src->is_if) {
- nir_if_rewrite_condition_ssa(use_src->parent_if, use_src, new_ssa);
- } else {
+ if (!use_src->is_if) {
assert(use_src->parent_instr != def->parent_instr);
+
/* Since def already dominates all of its uses, the only way a use can
* not be dominated by after_me is if it is between def and after_me in
* the instruction list.
*/
- if (!is_instr_between(def->parent_instr, after_me, use_src->parent_instr))
- nir_instr_rewrite_src_ssa(use_src->parent_instr, use_src, new_ssa);
+ if (is_instr_between(def->parent_instr, after_me, use_src->parent_instr))
+ continue;
}
+
+ nir_src_rewrite_ssa(use_src, new_ssa);
}
}
if (!is_swizzleless_move(copy))
return false;
- nir_instr_rewrite_src_ssa(src->parent_instr, src, copy->src[0].src.ssa);
-
- return true;
-}
-
-static bool
-copy_propagate_if(nir_src *src, nir_alu_instr *copy)
-{
- if (!is_swizzleless_move(copy))
- return false;
-
- nir_if_rewrite_condition_ssa(src->parent_if, src, copy->src[0].src.ssa);
+ nir_src_rewrite_ssa(src, copy->src[0].src.ssa);
return true;
}
bool progress = false;
nir_foreach_use_including_if_safe(src, &mov->dest.dest.ssa) {
- if (src->is_if)
- progress |= copy_propagate_if(src, mov);
- else if (src->parent_instr->type == nir_instr_type_alu)
+ if (!src->is_if && src->parent_instr->type == nir_instr_type_alu)
progress |= copy_propagate_alu(impl, container_of(src, nir_alu_src, src), mov);
else
progress |= copy_propagate(src, mov);