From 710fc19db7f6ab6efcf51abbc92a8ac03667acf0 Mon Sep 17 00:00:00 2001
From: jdh8d <jdh8d@git.zephyr-software.com>
Date: Fri, 2 Mar 2018 19:11:52 +0000
Subject: [PATCH] speed impr. on fix-calls and libIRDB-cfg

Former-commit-id: 5f182b4a6cddf4e2357eb45ffa8a2b15d0ec23be
---
 libIRDB/src/core/instruction.cpp | 4 ++--
 libIRDB/test/fix_calls.cpp       | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/libIRDB/src/core/instruction.cpp b/libIRDB/src/core/instruction.cpp
index acef37f5d..ab6df69d3 100644
--- a/libIRDB/src/core/instruction.cpp
+++ b/libIRDB/src/core/instruction.cpp
@@ -226,12 +226,12 @@ bool Instruction_t::IsFunctionExit() const
 
 	/* if there's a target that's outside this function */
 	Instruction_t *target=GetTarget();
-	if(target && !is_in_set(my_function->GetInstructions(),target))
+	if(target && target->GetFunction()!=GetFunction()) // !is_in_set(my_function->GetInstructions(),target))
 		return true;
 
 	/* if there's a fallthrough that's outside this function */
 	Instruction_t *ft=GetFallthrough();
-	if(fallthrough && !is_in_set(my_function->GetInstructions(),ft))
+	if(fallthrough && ft->GetFunction()!=GetFunction()) // !is_in_set(my_function->GetInstructions(),ft))
 		return true;
 
 	/* some instructions have no next-isntructions defined in the db, and we call them function exits */
diff --git a/libIRDB/test/fix_calls.cpp b/libIRDB/test/fix_calls.cpp
index 51ed3f794..734d09317 100644
--- a/libIRDB/test/fix_calls.cpp
+++ b/libIRDB/test/fix_calls.cpp
@@ -731,8 +731,7 @@ bool can_skip_safe_function(Instruction_t *call_insn)
 		return false;
 
 	/* if the call instruction isn't to a function entry point */
-	ControlFlowGraph_t* cfg=new ControlFlowGraph_t(func);
-	if(cfg->GetEntry()->GetInstructions()[0]!=target)
+	if(func->GetEntryPoint()!=target)
 	{
 		return false;
 	}
-- 
GitLab