aco/opt: Rename loop header phis
Fossil stats on top of !35269: Totals from 133 (0.16% of 81077) affected shaders: Instrs: 4328456 -> 4327891 (-0.01%) CodeSize: 22890004 -> 22887732 (-0.01%); split: -0.01%, +0.00% Latency: 28406452 -> 28404732 (-0.01%) InvThroughput: 5361458 -> 5361153 (-0.01%) Copies: 376788 -> 376222 (-0.15%) VALU: 2429210 -> 2428645 (-0.02%) VOPD: 57 -> 56 (-1.75%) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35270>
This commit is contained in:
@@ -4994,6 +4994,29 @@ validate_opt_ctx(opt_ctx& ctx)
|
||||
}
|
||||
}
|
||||
|
||||
void rename_loop_header_phis(opt_ctx& ctx) {
|
||||
for (Block& block : ctx.program->blocks) {
|
||||
if (!(block.kind & block_kind_loop_header))
|
||||
continue;
|
||||
|
||||
for (auto& instr : block.instructions) {
|
||||
if (!is_phi(instr))
|
||||
break;
|
||||
|
||||
for (unsigned i = 0; i < instr->operands.size(); i++) {
|
||||
if (!instr->operands[i].isTemp())
|
||||
continue;
|
||||
|
||||
ssa_info info = ctx.info[instr->operands[i].tempId()];
|
||||
while (info.is_temp()) {
|
||||
pseudo_propagate_temp(ctx, instr, info.temp, i);
|
||||
info = ctx.info[info.temp.id()];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} /* end namespace */
|
||||
|
||||
void
|
||||
@@ -5012,6 +5035,10 @@ optimize(Program* program)
|
||||
|
||||
validate_opt_ctx(ctx);
|
||||
|
||||
rename_loop_header_phis(ctx);
|
||||
|
||||
validate_opt_ctx(ctx);
|
||||
|
||||
ctx.uses = dead_code_analysis(program);
|
||||
|
||||
/* 2. Rematerialize constants in every block. */
|
||||
|
||||
Reference in New Issue
Block a user