mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-23 03:45:00 +00:00
shader: Fix block processing order in dead code elimination pass
This commit is contained in:
parent
705d326a6d
commit
5aa3a4d4a0
10 changed files with 60 additions and 75 deletions
|
@ -5,10 +5,10 @@
|
|||
|
||||
namespace Shader::Optimization {
|
||||
|
||||
void DeadCodeEliminationPass(IR::BlockList& program) {
|
||||
void DeadCodeEliminationPass(IR::Program& program) {
|
||||
// We iterate over the instructions in reverse order.
|
||||
// This is because removing an instruction reduces the number of uses for earlier instructions.
|
||||
for (IR::Block* const block : program) {
|
||||
for (IR::Block* const block : program.post_order_blocks) {
|
||||
auto it{block->end()};
|
||||
while (it != block->begin()) {
|
||||
--it;
|
||||
|
@ -20,4 +20,4 @@ void DeadCodeEliminationPass(IR::BlockList& program) {
|
|||
}
|
||||
}
|
||||
|
||||
} // namespace Shader::Optimization
|
||||
} // namespace Shader::Optimization
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Shader::Optimization {
|
|||
|
||||
void SsaRewritePass(IR::BlockList& program);
|
||||
void IdentityRemovalPass(IR::BlockList& program);
|
||||
void DeadCodeEliminationPass(IR::BlockList& program);
|
||||
void DeadCodeEliminationPass(IR::Program& program);
|
||||
void ConstantPropagationPass(IR::BlockList& program);
|
||||
void ResourceTrackingPass(IR::Program& program);
|
||||
void CollectShaderInfoPass(IR::Program& program);
|
||||
|
|
|
@ -219,7 +219,6 @@ using U64 = TypedValue<Type::U64>;
|
|||
using F16 = TypedValue<Type::F16>;
|
||||
using F32 = TypedValue<Type::F32>;
|
||||
using F64 = TypedValue<Type::F64>;
|
||||
using U1U32F32 = TypedValue<Type::U1 | Type::U32 | Type::F32>;
|
||||
using U32F32 = TypedValue<Type::U32 | Type::F32>;
|
||||
using U32U64 = TypedValue<Type::U32 | Type::U64>;
|
||||
using F32F64 = TypedValue<Type::F32 | Type::F64>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue