pan/bi: Reduce liveness calculations in DCE
Forward port of fc06b8b7 ("pan/mdg: Optimize liveness computation in
DCE")
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9164>
This commit is contained in:
committed by
Marge Bot
parent
3a4d985997
commit
9882a59a2f
@@ -34,7 +34,7 @@
|
||||
*/
|
||||
|
||||
bool
|
||||
bi_opt_dead_code_eliminate(bi_context *ctx, bi_block *block, bool soft)
|
||||
bi_opt_dead_code_eliminate(bi_context *ctx, bool soft)
|
||||
{
|
||||
bool progress = false;
|
||||
unsigned temp_count = bi_max_temp(ctx);
|
||||
@@ -42,24 +42,27 @@ bi_opt_dead_code_eliminate(bi_context *ctx, bi_block *block, bool soft)
|
||||
bi_invalidate_liveness(ctx);
|
||||
bi_compute_liveness(ctx);
|
||||
|
||||
uint16_t *live = mem_dup(block->base.live_out, temp_count * sizeof(uint16_t));
|
||||
bi_foreach_block(ctx, _block) {
|
||||
bi_block *block = (bi_block *) _block;
|
||||
uint16_t *live = mem_dup(block->base.live_out, temp_count * sizeof(uint16_t));
|
||||
|
||||
bi_foreach_instr_in_block_safe_rev(block, ins) {
|
||||
unsigned index = bi_get_node(ins->dest[0]);
|
||||
bi_foreach_instr_in_block_safe_rev(block, ins) {
|
||||
unsigned index = bi_get_node(ins->dest[0]);
|
||||
|
||||
if (index < temp_count && !(live[index] & bi_writemask(ins))) {
|
||||
if (soft || bi_side_effects(ins->op))
|
||||
ins->dest[0] = bi_null();
|
||||
else
|
||||
bi_remove_instruction(ins);
|
||||
if (index < temp_count && !(live[index] & bi_writemask(ins))) {
|
||||
if (soft || bi_side_effects(ins->op))
|
||||
ins->dest[0] = bi_null();
|
||||
else
|
||||
bi_remove_instruction(ins);
|
||||
|
||||
progress |= true;
|
||||
progress |= true;
|
||||
}
|
||||
|
||||
bi_liveness_ins_update(live, ins, temp_count);
|
||||
}
|
||||
|
||||
bi_liveness_ins_update(live, ins, temp_count);
|
||||
free(live);
|
||||
}
|
||||
|
||||
free(live);
|
||||
|
||||
return progress;
|
||||
}
|
||||
|
||||
@@ -1595,8 +1595,9 @@ bi_schedule(bi_context *ctx)
|
||||
bi_block *bblock = (bi_block *) block;
|
||||
bi_lower_fau(ctx, bblock);
|
||||
bi_schedule_block(ctx, bblock);
|
||||
bi_opt_dead_code_eliminate(ctx, bblock, true);
|
||||
}
|
||||
|
||||
bi_opt_dead_code_eliminate(ctx, true);
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
||||
@@ -2997,11 +2997,7 @@ bifrost_compile_shader_nir(nir_shader *nir,
|
||||
progress = false;
|
||||
|
||||
progress |= bi_opt_copy_prop(ctx);
|
||||
|
||||
bi_foreach_block(ctx, _block) {
|
||||
bi_block *block = (bi_block *) _block;
|
||||
progress |= bi_opt_dead_code_eliminate(ctx, block, false);
|
||||
}
|
||||
progress |= bi_opt_dead_code_eliminate(ctx, false);
|
||||
} while(progress);
|
||||
|
||||
bi_foreach_block(ctx, _block) {
|
||||
|
||||
@@ -745,7 +745,7 @@ void bi_print_shader(bi_context *ctx, FILE *fp);
|
||||
/* BIR passes */
|
||||
|
||||
bool bi_opt_copy_prop(bi_context *ctx);
|
||||
bool bi_opt_dead_code_eliminate(bi_context *ctx, bi_block *block, bool soft);
|
||||
bool bi_opt_dead_code_eliminate(bi_context *ctx, bool soft);
|
||||
void bi_opt_push_ubo(bi_context *ctx);
|
||||
void bi_schedule(bi_context *ctx);
|
||||
void bi_assign_scoreboard(bi_context *ctx);
|
||||
|
||||
Reference in New Issue
Block a user