summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
diff options
context:
space:
mode:
authorFernandoS27 <fsahmkow27@gmail.com>2021-04-03 01:48:39 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:26 +0200
commitbaec84247fe815199595d9e8077b71f3b5c8317e (patch)
tree84195625ffb43922ba87b25296057bdeb9f22a2c /src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
parentshader: Implement SR_LaneId (diff)
downloadyuzu-baec84247fe815199595d9e8077b71f3b5c8317e.tar
yuzu-baec84247fe815199595d9e8077b71f3b5c8317e.tar.gz
yuzu-baec84247fe815199595d9e8077b71f3b5c8317e.tar.bz2
yuzu-baec84247fe815199595d9e8077b71f3b5c8317e.tar.lz
yuzu-baec84247fe815199595d9e8077b71f3b5c8317e.tar.xz
yuzu-baec84247fe815199595d9e8077b71f3b5c8317e.tar.zst
yuzu-baec84247fe815199595d9e8077b71f3b5c8317e.zip
Diffstat (limited to 'src/shader_recompiler/ir_opt/constant_propagation_pass.cpp')
-rw-r--r--src/shader_recompiler/ir_opt/constant_propagation_pass.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp b/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
index 8999c3a3d..1720d7a09 100644
--- a/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
+++ b/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
@@ -374,17 +374,14 @@ std::optional<IR::Value> FoldCompositeExtractImpl(IR::Value inst_value, IR::Opco
if (inst->Opcode() == construct) {
return inst->Arg(first_index);
}
-
if (inst->Opcode() != insert) {
return std::nullopt;
}
-
IR::Value value_index{inst->Arg(2)};
if (!value_index.IsImmediate()) {
return std::nullopt;
}
-
- const u32 second_index = value_index.U32();
+ const u32 second_index{value_index.U32()};
if (first_index != second_index) {
IR::Value value_composite{inst->Arg(0)};
if (value_composite.IsImmediate()) {
@@ -404,8 +401,8 @@ void FoldCompositeExtract(IR::Inst& inst, IR::Opcode construct, IR::Opcode inser
if (!value_2.IsImmediate()) {
return;
}
- const u32 first_index = value_2.U32();
- auto result = FoldCompositeExtractImpl(value_1, insert, construct, first_index);
+ const u32 first_index{value_2.U32()};
+ const std::optional result{FoldCompositeExtractImpl(value_1, insert, construct, first_index)};
if (!result) {
return;
}