From ca22a66dd9dbc3a34d453bd4be7c7773afa3d964 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Fri, 23 Jan 2026 09:49:51 +0000 Subject: [PATCH] aco/insert_fp_mode: remove incorrect assertion This can happen if a loop has no continues, and the later code should work fine in this situation. This fixes war_thunder/0013a69e097b2471 on navi21. Signed-off-by: Rhys Perry Reviewed-by: Georg Lehmann Fixes: 6b9d28ab9bbd ("aco/insert_fp_mode: insert fp mode in reverse") Part-of: (cherry picked from commit e59a0df302f791cce51252beb1153572b8ca972f) --- .pick_status.json | 2 +- src/amd/compiler/aco_insert_fp_mode.cpp | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index e1db9508bc9..cb90969c16a 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2254,7 +2254,7 @@ "description": "aco/insert_fp_mode: remove incorrect assertion", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "6b9d28ab9bbd1578c06366dc792c10dbb3c366ef", "notes": null diff --git a/src/amd/compiler/aco_insert_fp_mode.cpp b/src/amd/compiler/aco_insert_fp_mode.cpp index fef489817b6..a5609ecace1 100644 --- a/src/amd/compiler/aco_insert_fp_mode.cpp +++ b/src/amd/compiler/aco_insert_fp_mode.cpp @@ -454,16 +454,16 @@ emit_set_mode_block(fp_mode_ctx* ctx, Block* block) for (uint32_t pred : block->linear_preds) max_pred = MAX2(max_pred, pred); - assert(max_pred != 0); - - mode_mask to_set = 0; - /* Check if the any mode was changed during the loop. */ - u_foreach_bit (i, fp_state.required) { - if (ctx->last_set[i] <= max_pred) - to_set |= BITFIELD_BIT(i); + if (max_pred >= block->index) { + mode_mask to_set = 0; + /* Check if the any mode was changed during the loop. */ + u_foreach_bit (i, fp_state.required) { + if (ctx->last_set[i] <= max_pred) + to_set |= BITFIELD_BIT(i); + } + if (to_set) + set_mode(ctx, block, fp_state, 0, to_set); } - if (to_set) - set_mode(ctx, block, fp_state, 0, to_set); } ctx->block_states[block->index] = fp_state;