From a1d096c1efb09526046c046a89d4161cf5533378 Mon Sep 17 00:00:00 2001
From: clc5q <clc5q@git.zephyr-software.com>
Date: Fri, 21 Mar 2014 03:26:51 +0000
Subject: [PATCH] Fix stack delta computation for funcs with alloca calls AND
 leave opcodes.

---
 SMPFunction.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/SMPFunction.cpp b/SMPFunction.cpp
index d6f3dd90..2b01fd20 100644
--- a/SMPFunction.cpp
+++ b/SMPFunction.cpp
@@ -1311,6 +1311,10 @@ bool SMPFunction::AnalyzeStackPointerDeltas(void) {
 						(unsigned long) InstAddr);
 					break;
 				}
+				else if (CurrInst->MDIsLeaveInstr()) {
+					// LEAVE is a restoration of a stack pointer, not processed by CurrInst->MDIsStackPtrSaveOrRestore()
+					StackPointerRestoreSeen = true; 
+				}
 
 				// Update VarKill and DownExposedDefs sets for DEFs in current instruction.
 				// Dataflow equation for killed variables: If a variable is defined in any
-- 
GitLab