From 5bfc0259be84a897288632dd4a040239c883005e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 8 Jun 2024 23:19:01 +0200 Subject: [PATCH] Optimize away the redundant vector loads in the Wipeout games. --- Core/MIPS/IR/IRPassSimplify.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Core/MIPS/IR/IRPassSimplify.cpp b/Core/MIPS/IR/IRPassSimplify.cpp index 70c668fe98e3..f9a3294fad7a 100644 --- a/Core/MIPS/IR/IRPassSimplify.cpp +++ b/Core/MIPS/IR/IRPassSimplify.cpp @@ -2200,13 +2200,23 @@ bool OptimizeLoadsAfterStores(const IRWriter &in, IRWriter &out, const IROptions case IROp::Store32: if (next.op == IROp::Load32 && next.constant == inst.constant && - next.dest == inst.src3 && + next.dest == inst.dest && next.src1 == inst.src1) { // The upcoming load is completely redundant. // Skip it. i++; } break; + case IROp::StoreVec4: + if (next.op == IROp::LoadVec4 && + next.constant == inst.constant && + next.dest == inst.dest && + next.src1 == inst.src1) { + // The upcoming load is completely redundant. These are common in Wipeout. + // Skip it. NOTE: It looks like vector load/stores uses different register assignments, but there's a union between dest and src3. + i++; + } + break; default: break; }