summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2024-09-07 07:52:52 +0800
committerGitHub <noreply@github.com>2024-09-06 16:52:52 -0700
commit69ee8f63cdb0dad573f65b0b5fc45aad01ec8321 (patch)
treef7cd5c74172a3e84677b1a5fc05d8042bebeafb7 /source
parentdcd6c246a14d2321e75c657f381b08b7ab08016e (diff)
Correct control flow in getParentBreakBlockSet (#5024)
Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-ir-util.cpp4
1 files changed, 4 insertions, 0 deletions
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<IRBlock*> getParentBreakBlockSet(IRDominatorTree* dom, IRBlock* block)
currBlock = dom->getImmediateDominator(currBlock))
{
if (auto loopInst = as<IRLoop>(currBlock->getTerminator()))
+ {
if (!dom->dominates(loopInst->getBreakBlock(), block))
parentBreakBlocksSet.add(loopInst->getBreakBlock());
+ }
else if (auto switchInst = as<IRSwitch>(currBlock->getTerminator()))
+ {
if (!dom->dominates(switchInst->getBreakLabel(), block))
parentBreakBlocksSet.add(switchInst->getBreakLabel());
+ }
}
return parentBreakBlocksSet;