aco: Fix vector::reserve() being called with the wrong size

The container is moved from before and hence returns size 0. To get the
correct value, the new instruction container must be used instead.

This was flagged by clang-tidy. The fixed call still triggers the
corresponding diagnostic, hence this change silences it by adding a
redundant clear() after move.

Fixes: 7f1b537304 ("aco: add new NOP insertion pass for GFX6-9")
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9432>
This commit is contained in:
Tony Wasserka 2021-03-04 17:32:39 +01:00
parent e30994a471
commit 97c97781f6
1 changed files with 2 additions and 1 deletions

View File

@ -751,7 +751,8 @@ void handle_block(Program *program, Ctx& ctx, Block& block)
std::vector<aco_ptr<Instruction>> old_instructions = std::move(block.instructions);
block.instructions.reserve(block.instructions.size());
block.instructions.clear(); // Silence clang-analyzer-cplusplus.Move warning
block.instructions.reserve(old_instructions.size());
for (aco_ptr<Instruction>& instr : old_instructions) {
Handle(program, &block, ctx, instr, block.instructions);