summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
diff options
context:
space:
mode:
authorGravatar FernandoS272021-04-03 01:48:39 +0200
committerGravatar ameerj2021-07-22 21:51:26 -0400
commitbaec84247fe815199595d9e8077b71f3b5c8317e (patch)
tree84195625ffb43922ba87b25296057bdeb9f22a2c /src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
parentshader: Implement SR_LaneId (diff)
downloadyuzu-baec84247fe815199595d9e8077b71f3b5c8317e.tar.gz
yuzu-baec84247fe815199595d9e8077b71f3b5c8317e.tar.xz
yuzu-baec84247fe815199595d9e8077b71f3b5c8317e.zip
shader: Address Feedback
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
374 if (inst->Opcode() == construct) { 374 if (inst->Opcode() == construct) {
375 return inst->Arg(first_index); 375 return inst->Arg(first_index);
376 } 376 }
377
378 if (inst->Opcode() != insert) { 377 if (inst->Opcode() != insert) {
379 return std::nullopt; 378 return std::nullopt;
380 } 379 }
381
382 IR::Value value_index{inst->Arg(2)}; 380 IR::Value value_index{inst->Arg(2)};
383 if (!value_index.IsImmediate()) { 381 if (!value_index.IsImmediate()) {
384 return std::nullopt; 382 return std::nullopt;
385 } 383 }
386 384 const u32 second_index{value_index.U32()};
387 const u32 second_index = value_index.U32();
388 if (first_index != second_index) { 385 if (first_index != second_index) {
389 IR::Value value_composite{inst->Arg(0)}; 386 IR::Value value_composite{inst->Arg(0)};
390 if (value_composite.IsImmediate()) { 387 if (value_composite.IsImmediate()) {
@@ -404,8 +401,8 @@ void FoldCompositeExtract(IR::Inst& inst, IR::Opcode construct, IR::Opcode inser
404 if (!value_2.IsImmediate()) { 401 if (!value_2.IsImmediate()) {
405 return; 402 return;
406 } 403 }
407 const u32 first_index = value_2.U32(); 404 const u32 first_index{value_2.U32()};
408 auto result = FoldCompositeExtractImpl(value_1, insert, construct, first_index); 405 const std::optional result{FoldCompositeExtractImpl(value_1, insert, construct, first_index)};
409 if (!result) { 406 if (!result) {
410 return; 407 return;
411 } 408 }