mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 20:18:12 +02:00
aco: perform dce for blocks skipped for process_block()
We might need to DCE users of dead instructions removed by process_block(). Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Fixes:9e8ba10447("aco/vn: remove dead instructions early") Reviewed-by: Daniel Schürmann <daniel@schuermann.dev> (cherry picked from commit17b18496f6) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40359>
This commit is contained in:
parent
6e5d08c8e5
commit
223af79274
2 changed files with 20 additions and 3 deletions
|
|
@ -4374,7 +4374,7 @@
|
|||
"description": "aco: perform dce for blocks skipped for process_block()",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "9e8ba10447f08ee757f6a4719ff23960a2b18c6b",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -427,6 +427,21 @@ process_block(vn_ctx& ctx, Block& block)
|
|||
block.instructions = std::move(new_instructions);
|
||||
}
|
||||
|
||||
void
|
||||
dce_instructions(vn_ctx& ctx, Block& block)
|
||||
{
|
||||
std::vector<aco_ptr<Instruction>> new_instructions;
|
||||
new_instructions.reserve(block.instructions.size());
|
||||
|
||||
for (aco_ptr<Instruction>& instr : block.instructions) {
|
||||
if (is_dead(ctx.uses, instr.get()))
|
||||
continue;
|
||||
new_instructions.emplace_back(std::move(instr));
|
||||
}
|
||||
|
||||
block.instructions = std::move(new_instructions);
|
||||
}
|
||||
|
||||
void
|
||||
rename_phi_operands(Block& block, aco::unordered_map<uint32_t, Temp>& renames)
|
||||
{
|
||||
|
|
@ -467,10 +482,12 @@ value_numbering(Program* program)
|
|||
if (block.logical_idom == (int)block.index)
|
||||
ctx.expr_values.clear();
|
||||
|
||||
if (block.logical_idom != -1)
|
||||
if (block.logical_idom != -1) {
|
||||
process_block(ctx, block);
|
||||
else
|
||||
} else {
|
||||
dce_instructions(ctx, block);
|
||||
rename_phi_operands(block, ctx.renames);
|
||||
}
|
||||
|
||||
/* increment exec_id when entering nested control flow */
|
||||
if (block.kind & block_kind_branch || block.kind & block_kind_loop_preheader ||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue