From 9c9ece3d95b69f93feaf6250e7a64318903c7aa8 Mon Sep 17 00:00:00 2001 From: Eladash <18193363+elad335@users.noreply.github.com> Date: Wed, 27 Mar 2024 13:19:41 +0200 Subject: [PATCH] SPU LLVM: Fix Forwarding GPR stores savestate safety --- rpcs3/Emu/Cell/SPULLVMRecompiler.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/Cell/SPULLVMRecompiler.cpp b/rpcs3/Emu/Cell/SPULLVMRecompiler.cpp index 4a2a616bbd..107bf3b64c 100644 --- a/rpcs3/Emu/Cell/SPULLVMRecompiler.cpp +++ b/rpcs3/Emu/Cell/SPULLVMRecompiler.cpp @@ -1050,7 +1050,7 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator m_ir->SetInsertPoint(check); update_pc(addr); - if (may_be_unsafe_for_savestate && std::none_of(std::begin(m_block->phi), std::end(m_block->phi), FN(!!x))) + if (may_be_unsafe_for_savestate && m_block && m_block->bb->preds.empty()) { may_be_unsafe_for_savestate = false; } @@ -1904,8 +1904,10 @@ public: auto si = llvm::cast(m_ir->Insert(bs->clone())); if (b2->store[i] == nullptr) { + // Protect against backwards ordering now b2->store[i] = si; b2->store_context_last_id[i] = 0; + b2->store_context_first_id[i] = b2->store_context_ctr[i] + 1; if (!std::count(block_q.begin() + bi, block_q.end(), b2)) {