mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
aco/optimizer_postRA: Delete dead instructions more efficiently.
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com> Reviewed-by: Daniel Schürmann <daniel@schuermann.dev> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18103>
This commit is contained in:
parent
7263a29794
commit
36bc3afb8b
1 changed files with 11 additions and 4 deletions
|
|
@ -581,10 +581,17 @@ optimize_postRA(Program* program)
|
|||
* no longer have any uses.
|
||||
*/
|
||||
for (auto& block : program->blocks) {
|
||||
auto new_end = std::remove_if(block.instructions.begin(), block.instructions.end(),
|
||||
[&ctx](const aco_ptr<Instruction>& instr)
|
||||
{ return !instr || is_dead(ctx.uses, instr.get()); });
|
||||
block.instructions.resize(new_end - block.instructions.begin());
|
||||
std::vector<aco_ptr<Instruction>> instructions;
|
||||
instructions.reserve(block.instructions.size());
|
||||
|
||||
for (aco_ptr<Instruction>& instr : block.instructions) {
|
||||
if (!instr || is_dead(ctx.uses, instr.get()))
|
||||
continue;
|
||||
|
||||
instructions.emplace_back(std::move(instr));
|
||||
}
|
||||
|
||||
block.instructions = std::move(instructions);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue