diff --git a/Source/Core/Core/PowerPC/PPCAnalyst.cpp b/Source/Core/Core/PowerPC/PPCAnalyst.cpp index 2a06bd3ae2..0735eda2f7 100644 --- a/Source/Core/Core/PowerPC/PPCAnalyst.cpp +++ b/Source/Core/Core/PowerPC/PPCAnalyst.cpp @@ -723,6 +723,11 @@ u32 PPCAnalyzer::Analyze(u32 address, CodeBlock* block, CodeBuffer* buffer, u32 (inst.BO & BO_DONT_DECREMENT_FLAG) && (inst.BO & BO_DONT_CHECK_CONDITION)) { // bclrx with unconditional branch = return + // Follow it if we can propagate the LR value of the last CALL instruction. + // Through it would be easy to track the upper level of call/return, + // we can't guarantee the LR value. The PPC ABI forces all functions to push + // the LR value on the stack as there are no spare registers. So we'd need + // to check all store instruction to not alias with the stack. follow = true; destination = code[caller].address + 4; found_call = false; diff --git a/Source/Core/Core/PowerPC/PPCAnalyst.h b/Source/Core/Core/PowerPC/PPCAnalyst.h index 1754c79740..5a3b86a57a 100644 --- a/Source/Core/Core/PowerPC/PPCAnalyst.h +++ b/Source/Core/Core/PowerPC/PPCAnalyst.h @@ -190,7 +190,8 @@ public: // Requires JIT support to be enabled. OPTION_CONDITIONAL_CONTINUE = (1 << 0), - // Try to inline unconditional branches. + // Try to inline unconditional branches/calls/returns. + // Also track the LR value to follow unconditional return instructions. // Might require JIT intervention to support it correctly. // Especially if the BLR optimization is used. OPTION_BRANCH_FOLLOW = (1 << 1),