summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2021-03-31 19:46:38 -0300
committerGravatar ameerj2021-07-22 21:51:25 -0400
commit5f22cd89e20cd39c1395b7bd3b8e667a40f53751 (patch)
treecbeafb6b9b75150822c216eb41ff7d098872b3d9 /src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
parentshader: Implement LDG .U.128 as .128 (diff)
downloadyuzu-5f22cd89e20cd39c1395b7bd3b8e667a40f53751.tar.gz
yuzu-5f22cd89e20cd39c1395b7bd3b8e667a40f53751.tar.xz
yuzu-5f22cd89e20cd39c1395b7bd3b8e667a40f53751.zip
shader: Fix constant propagation to use reverse post order
Diffstat (limited to 'src/shader_recompiler/ir_opt/constant_propagation_pass.cpp')
-rw-r--r--src/shader_recompiler/ir_opt/constant_propagation_pass.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp b/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
index 052f1609b..7da4d50ef 100644
--- a/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
+++ b/src/shader_recompiler/ir_opt/constant_propagation_pass.cpp
@@ -5,6 +5,7 @@
5#include <algorithm> 5#include <algorithm>
6#include <tuple> 6#include <tuple>
7#include <type_traits> 7#include <type_traits>
8#include <ranges>
8 9
9#include "common/bit_cast.h" 10#include "common/bit_cast.h"
10#include "common/bit_util.h" 11#include "common/bit_util.h"
@@ -424,7 +425,7 @@ void ConstantPropagation(IR::Block& block, IR::Inst& inst) {
424} // Anonymous namespace 425} // Anonymous namespace
425 426
426void ConstantPropagationPass(IR::Program& program) { 427void ConstantPropagationPass(IR::Program& program) {
427 for (IR::Block* const block : program.post_order_blocks) { 428 for (IR::Block* const block : program.post_order_blocks | std::views::reverse) {
428 for (IR::Inst& inst : block->Instructions()) { 429 for (IR::Inst& inst : block->Instructions()) {
429 ConstantPropagation(*block, inst); 430 ConstantPropagation(*block, inst);
430 } 431 }