From 69ee8f63cdb0dad573f65b0b5fc45aad01ec8321 Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Sat, 7 Sep 2024 07:52:52 +0800 Subject: Correct control flow in getParentBreakBlockSet (#5024) Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> Co-authored-by: Yong He --- source/slang/slang-ir-util.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source') diff --git a/source/slang/slang-ir-util.cpp b/source/slang/slang-ir-util.cpp index c4fc60bd2..f81cde30b 100644 --- a/source/slang/slang-ir-util.cpp +++ b/source/slang/slang-ir-util.cpp @@ -1430,11 +1430,15 @@ HashSet getParentBreakBlockSet(IRDominatorTree* dom, IRBlock* block) currBlock = dom->getImmediateDominator(currBlock)) { if (auto loopInst = as(currBlock->getTerminator())) + { if (!dom->dominates(loopInst->getBreakBlock(), block)) parentBreakBlocksSet.add(loopInst->getBreakBlock()); + } else if (auto switchInst = as(currBlock->getTerminator())) + { if (!dom->dominates(switchInst->getBreakLabel(), block)) parentBreakBlocksSet.add(switchInst->getBreakLabel()); + } } return parentBreakBlocksSet; -- cgit v1.2.3