diff options
| -rw-r--r-- | src/shader_recompiler/frontend/ir/microinstruction.cpp | 4 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/value.h | 7 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/shader_recompiler/frontend/ir/microinstruction.cpp b/src/shader_recompiler/frontend/ir/microinstruction.cpp index 701746a0c..e3350931b 100644 --- a/src/shader_recompiler/frontend/ir/microinstruction.cpp +++ b/src/shader_recompiler/frontend/ir/microinstruction.cpp | |||
| @@ -279,8 +279,10 @@ void Inst::ClearArgs() { | |||
| 279 | if (!value.IsImmediate()) { | 279 | if (!value.IsImmediate()) { |
| 280 | UndoUse(value); | 280 | UndoUse(value); |
| 281 | } | 281 | } |
| 282 | value = {}; | ||
| 283 | } | 282 | } |
| 283 | // Reset arguments to null | ||
| 284 | // std::memset was measured to be faster on MSVC than std::ranges:fill | ||
| 285 | std::memset(&args, 0, sizeof(args)); | ||
| 284 | } | 286 | } |
| 285 | } | 287 | } |
| 286 | 288 | ||
diff --git a/src/shader_recompiler/frontend/ir/value.h b/src/shader_recompiler/frontend/ir/value.h index 5425e42a1..7b20824ed 100644 --- a/src/shader_recompiler/frontend/ir/value.h +++ b/src/shader_recompiler/frontend/ir/value.h | |||
| @@ -34,7 +34,7 @@ struct AssociatedInsts; | |||
| 34 | 34 | ||
| 35 | class Value { | 35 | class Value { |
| 36 | public: | 36 | public: |
| 37 | Value() noexcept : type{IR::Type::Void}, inst{nullptr} {} | 37 | Value() noexcept = default; |
| 38 | explicit Value(IR::Inst* value) noexcept; | 38 | explicit Value(IR::Inst* value) noexcept; |
| 39 | explicit Value(IR::Block* value) noexcept; | 39 | explicit Value(IR::Block* value) noexcept; |
| 40 | explicit Value(IR::Reg value) noexcept; | 40 | explicit Value(IR::Reg value) noexcept; |
| @@ -78,9 +78,9 @@ public: | |||
| 78 | private: | 78 | private: |
| 79 | void ValidateAccess(IR::Type expected) const; | 79 | void ValidateAccess(IR::Type expected) const; |
| 80 | 80 | ||
| 81 | IR::Type type; | 81 | IR::Type type{}; |
| 82 | union { | 82 | union { |
| 83 | IR::Inst* inst; | 83 | IR::Inst* inst{}; |
| 84 | IR::Block* label; | 84 | IR::Block* label; |
| 85 | IR::Reg reg; | 85 | IR::Reg reg; |
| 86 | IR::Pred pred; | 86 | IR::Pred pred; |
| @@ -95,6 +95,7 @@ private: | |||
| 95 | f64 imm_f64; | 95 | f64 imm_f64; |
| 96 | }; | 96 | }; |
| 97 | }; | 97 | }; |
| 98 | static_assert(static_cast<u32>(IR::Type::Void) == 0, "memset relies on IR::Type being zero"); | ||
| 98 | static_assert(std::is_trivially_copyable_v<Value>); | 99 | static_assert(std::is_trivially_copyable_v<Value>); |
| 99 | 100 | ||
| 100 | template <IR::Type type_> | 101 | template <IR::Type type_> |