From d14b1f85a833bb2b1ad7d48c06b44a039b2245c5 Mon Sep 17 00:00:00 2001
From: Clark Coleman <clc@zephyr-software.com>
Date: Tue, 6 Oct 2020 21:01:17 -0400
Subject: [PATCH] SPARK: Fix SHORT_CIRCUIT_BRANCHes that were misclassified as
 SHORT_CIRCUIT_LOOP_EXITs.

---
 src/base/SMPFunction.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/base/SMPFunction.cpp b/src/base/SMPFunction.cpp
index 29a277a9..6649038c 100644
--- a/src/base/SMPFunction.cpp
+++ b/src/base/SMPFunction.cpp
@@ -11033,7 +11033,7 @@ void SMPFunction::BuildShadowCFG(void) {
 void SMPFunction::CoalesceShadowBlocks(int LeftBlockNum, int RightBlockNum, bool NegateLeft, SMPoperator TopOper, int NewFTNum, int NewNFTNum) {
 	assert((0 <= LeftBlockNum) && (LeftBlockNum < (int)this->ShadowCFGBlocks.size()));
 	assert((0 <= RightBlockNum) && (RightBlockNum < (int)this->ShadowCFGBlocks.size()));
-	bool LoopExitCase = !(this->AreBlocksInSameLoops(NewFTNum, NewNFTNum));
+	bool LoopExitCase = this->IsBlockInAnyLoop(LeftBlockNum) && this->IsBlockInAnyLoop(RightBlockNum) && (!(this->AreBlocksInSameLoops(NewFTNum, NewNFTNum)));
 	STARSCFGBlock *LeftCFGBlock = this->ShadowCFGBlocks[LeftBlockNum];
 	STARSCFGBlock *RightCFGBlock = this->ShadowCFGBlocks[RightBlockNum];
 
-- 
GitLab