diff --git a/.pick_status.json b/.pick_status.json index 0ff5d9e6e08..464eb779160 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -3144,7 +3144,7 @@ "description": "nir/opt_remove_phis: skip unreachable phis", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "60776f87c38f69507d60591b46b3ea2efba8e188", "notes": null diff --git a/src/compiler/nir/nir_opt_remove_phis.c b/src/compiler/nir/nir_opt_remove_phis.c index 283acd59ff1..7f126a79834 100644 --- a/src/compiler/nir/nir_opt_remove_phis.c +++ b/src/compiler/nir/nir_opt_remove_phis.c @@ -95,6 +95,10 @@ remove_phis_instr(nir_builder *b, nir_phi_instr *phi, void *unused) nir_def *def = NULL; bool needs_remat = false; + /* Skip unreachable phis, they should be removed by nir_opt_dead_cf. */ + if (nir_block_is_unreachable(block)) + return false; + nir_foreach_phi_src(src, phi) { /* For phi nodes at the beginning of loops, we may encounter some * sources from backedges that point back to the destination of the