Module: Mesa Branch: staging/21.0 Commit: c540c6c611c26368a396e6ec4ce0a9ce904a26c3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c540c6c611c26368a396e6ec4ce0a9ce904a26c3
Author: Tony Wasserka <[email protected]> Date: Thu Mar 4 17:32:39 2021 +0100 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: 7f1b537304d ("aco: add new NOP insertion pass for GFX6-9") Reviewed-by: Rhys Perry <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9432> (cherry picked from commit 97c97781f6a94e5c8209266ec996fe6caff04dff) --- .pick_status.json | 2 +- src/amd/compiler/aco_insert_NOPs.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 5572ceceba4..93fa5ed4548 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1003,7 +1003,7 @@ "description": "aco: Fix vector::reserve() being called with the wrong size", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": "7f1b537304d4837c907a9299dab3a7acf2518b0b" }, diff --git a/src/amd/compiler/aco_insert_NOPs.cpp b/src/amd/compiler/aco_insert_NOPs.cpp index a609c18d5dc..63b8aeeaa21 100644 --- a/src/amd/compiler/aco_insert_NOPs.cpp +++ b/src/amd/compiler/aco_insert_NOPs.cpp @@ -754,7 +754,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); _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
