From 774a1094298d3de057395e48effe4b78ca70362e Mon Sep 17 00:00:00 2001
From: clc5q <clc5q@git.zephyr-software.com>
Date: Tue, 5 Jan 2016 23:04:34 +0000
Subject: [PATCH] Fix phase ordering assertion issue.

Former-commit-id: 5b08f17e4b816d3c2a1e58a045d165abbe730f6a
---
 src/base/SMPFunction.cpp | 19 ++++++++++++-------
 src/base/SMPInstr.cpp    |  5 -----
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/base/SMPFunction.cpp b/src/base/SMPFunction.cpp
index ed9cd53b..57c0c8da 100644
--- a/src/base/SMPFunction.cpp
+++ b/src/base/SMPFunction.cpp
@@ -3835,15 +3835,20 @@ void SMPFunction::AnalyzeFunc(void) {
 					CurrBlock->SetUnreachableBlock(true);
 					SMP_msg("INFO: Marking basic block unreachable due to call 0 instruction at %llx\n", (unsigned long long) InstAddr);
 				}
-				else if (STARS_BADADDR != CallTarget) {
-					if (INDIR_CALL == InstDataFlowType) {
-						this->SetHasIndirectCalls();
+				else {
+					if (CALL == InstDataFlowType) {
+						bool NewDirectTarget = this->AddDirectCallTarget(CallTarget);
+					}
+					else { // INDIR_CALL
+						if (STARS_BADADDR == CallTarget) {
+							this->SetHasUnresolvedIndirectCalls();
+						}
+						else {
+							bool NewIndirectTarget = this->AddIndirectCallTarget(CallTarget);
+						}
 					}
 				}
-				else { // STARS_BADADDR == CallTarget
-
-				}
-			}
+			} // end if CALL or INDIR_CALL
 		} // end for each inst
 		CurrBlock->Analyze();
 		// Set up the map of instructions to basic blocks.
diff --git a/src/base/SMPInstr.cpp b/src/base/SMPInstr.cpp
index d708d8de..51e7f4c8 100644
--- a/src/base/SMPInstr.cpp
+++ b/src/base/SMPInstr.cpp
@@ -5366,15 +5366,10 @@ void SMPInstr::SetFixedCallJump(void) {
 	this->RTL.GetRT(0)->SetLeftOperand(this->STARSInstPtr->MakeVoidOpnd());
 	if (this->type == JUMP) {
 		this->type = CALL;   // Important: Change type to CALL only after calling GetJumpTarget()
-		bool NewDirectTarget = this->GetBlock()->GetFunc()->AddDirectCallTarget(this->CallTarget);
 	}
 	else {
 		assert(this->type == INDIR_JUMP);
 		this->type = INDIR_CALL;
-		bool NewIndirectTarget = this->GetBlock()->GetFunc()->AddIndirectCallTarget(this->CallTarget);
-		if (STARS_BADADDR == this->CallTarget) {
-			this->GetBlock()->GetFunc()->SetHasUnresolvedIndirectCalls();
-		}
 	}
 	return;
 } // end of SMPInstr::SetFixedCallJump()
-- 
GitLab