diff --git a/src/freedreno/ir3/ir3_compiler_nir.c b/src/freedreno/ir3/ir3_compiler_nir.c index 0746756d319..692f4f310d9 100644 --- a/src/freedreno/ir3/ir3_compiler_nir.c +++ b/src/freedreno/ir3/ir3_compiler_nir.c @@ -5818,6 +5818,11 @@ ir3_compile_shader_nir(struct ir3_compiler *compiler, if (IR3_PASS(ir, ir3_imm_const_to_preamble, so)) { progress = true; + /* Propagate immediates created by ir3_imm_const_to_preamble but make sure + * we don't lower any more immediates to const registers. + */ + IR3_PASS(ir, ir3_cp, so, false); + /* ir3_imm_const_to_preamble might create duplicate a1.x movs. */ IR3_PASS(ir, ir3_cse); } diff --git a/src/freedreno/ir3/ir3_preamble.c b/src/freedreno/ir3/ir3_preamble.c index 33cc2fae447..bbfa7fb01b5 100644 --- a/src/freedreno/ir3/ir3_preamble.c +++ b/src/freedreno/ir3/ir3_preamble.c @@ -44,19 +44,7 @@ ir3_imm_const_to_preamble(struct ir3 *ir, struct ir3_shader_variant *so) struct ir3_instruction *src = ir3_create_collect(&build, movs, components); unsigned dst = ir3_const_imm_index_to_reg(consts, i); - struct ir3_instruction *stc = ir3_store_const(so, &build, src, dst); - - /* We cannot run ir3_cp anymore as that would potentially lower more - * immediates to const registers because we reset count to 0 below (which - * is necessary to stop the driver from uploading the immediates). So we - * have to manually propagate the stc immediate. - */ - struct ir3_instruction *mov_imm = stc->srcs[0]->def->instr; - assert(mov_imm->opc == OPC_MOV); - assert(mov_imm->srcs[0]->flags & IR3_REG_IMMED); - - stc->srcs[0] = mov_imm->srcs[0]; - list_del(&mov_imm->node); + ir3_store_const(so, &build, src, dst); } imms->count = 0;