diff --git a/.pick_status.json b/.pick_status.json index c640b7433cc..b784c0f31a1 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -94,7 +94,7 @@ "description": "nir/opt_loop: Fix handling else-breaks in merge_terminators", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "9995f336e60c2197236c7d815e8ab20ede18b781", "notes": null diff --git a/src/compiler/nir/nir_opt_loop.c b/src/compiler/nir/nir_opt_loop.c index 1f996854146..f52f23843aa 100644 --- a/src/compiler/nir/nir_opt_loop.c +++ b/src/compiler/nir/nir_opt_loop.c @@ -557,7 +557,13 @@ merge_terminators(nir_builder *b, nir_if *dest_if, nir_if *src_if) } b->cursor = nir_before_src(&dest_if->condition); - nir_def *new_c = nir_ior(b, dest_if->condition.ssa, src_if->condition.ssa); + + nir_def *new_c = NULL; + if (then_break) + new_c = nir_ior(b, dest_if->condition.ssa, src_if->condition.ssa); + else + new_c = nir_iand(b, dest_if->condition.ssa, src_if->condition.ssa); + nir_src_rewrite(&dest_if->condition, new_c); }