Mesa (master): aco: zero-initialize Temp
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Apr 6 19:39:15 UTC 2020
Module: Mesa
Branch: master
Commit: 20a4b1461bab25af48d73b07ca5bafafc397eb2e
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=20a4b1461bab25af48d73b07ca5bafafc397eb2e
Author: Rhys Perry <pendingchaos02 at gmail.com>
Date: Mon Apr 6 14:08:39 2020 +0100
aco: zero-initialize Temp
Fixes dEQP-VK.transform_feedback.* crashes from accesses garbage
temporaries in emit_extract_vector().
Fixes: 85521061 ("aco: prepare helper functions for subdword handling")
Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4463>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4463>
---
src/amd/compiler/aco_instruction_selection.cpp | 1 -
src/amd/compiler/aco_ir.h | 2 +-
src/amd/compiler/aco_optimizer.cpp | 2 ++
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp
index 2d9b78792f3..6a63d5d8718 100644
--- a/src/amd/compiler/aco_instruction_selection.cpp
+++ b/src/amd/compiler/aco_instruction_selection.cpp
@@ -274,7 +274,6 @@ Temp emit_extract_vector(isel_context* ctx, Temp src, uint32_t idx, RegClass dst
assert(src.bytes() > (idx * dst_rc.bytes()));
Builder bld(ctx->program, ctx->block);
auto it = ctx->allocated_vec.find(src.id());
- /* the size check needs to be early because elements other than 0 may be garbage */
if (it != ctx->allocated_vec.end() && dst_rc.bytes() == it->second[idx].regClass().bytes()) {
if (it->second[idx].regClass() == dst_rc) {
return it->second[idx];
diff --git a/src/amd/compiler/aco_ir.h b/src/amd/compiler/aco_ir.h
index b05f809d21f..17ce7e39f1b 100644
--- a/src/amd/compiler/aco_ir.h
+++ b/src/amd/compiler/aco_ir.h
@@ -262,7 +262,7 @@ static constexpr RegClass v8b{RegClass::v8b};
* and SSA id.
*/
struct Temp {
- Temp() = default;
+ Temp() noexcept : id_(0), reg_class(RegType::sgpr, 0) {}
constexpr Temp(uint32_t id, RegClass cls) noexcept
: id_(id), reg_class(cls) {}
diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp
index 7a5b8f9d756..72ae710f838 100644
--- a/src/amd/compiler/aco_optimizer.cpp
+++ b/src/amd/compiler/aco_optimizer.cpp
@@ -103,6 +103,8 @@ struct ssa_info {
};
uint32_t label;
+ ssa_info() : label(0) {}
+
void add_label(Label new_label)
{
/* Since all labels which use "instr" use it for the same thing
More information about the mesa-commit
mailing list