nir/opt_move_to_top: check can_reorder & can_speculate

No effect now, but may be needed in the future.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36099>
This commit is contained in:
Marek Olšák
2025-07-13 05:56:34 -04:00
committed by Marge Bot
parent 6a85761c4c
commit b35e8a38e7

View File

@@ -80,6 +80,18 @@ can_move_src_to_top(nir_src *src, void *_state)
instr->pass_flags |= PASS_FLAG_CANT_MOVE;
return false;
}
if (instr->block == nir_start_block(state->impl) &&
!nir_intrinsic_can_reorder(nir_instr_as_intrinsic(instr))) {
instr->pass_flags |= PASS_FLAG_CANT_MOVE;
return false;
}
}
if (instr->block != nir_start_block(state->impl) &&
!nir_instr_can_speculate(instr)) {
instr->pass_flags |= PASS_FLAG_CANT_MOVE;
return false;
}
if (!nir_foreach_src(instr, can_move_src_to_top, state)) {