From e04abb54bc69d90a503852d60a89e8bac7b60ec8 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 25 Oct 2023 12:21:35 -0700 Subject: Fix single iteration loop detection logic. (#3287) Co-authored-by: Yong He --- source/slang/slang-ir-simplify-cfg.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/slang/slang-ir-simplify-cfg.cpp b/source/slang/slang-ir-simplify-cfg.cpp index 0fe752c8f..127a515ce 100644 --- a/source/slang/slang-ir-simplify-cfg.cpp +++ b/source/slang/slang-ir-simplify-cfg.cpp @@ -97,8 +97,8 @@ static bool isTrivialSingleIterationLoop( { if (!context.domTree->dominates(loop->getParent(), branchTarget)) return false; - if (targetBlock != loop->getBreakBlock()) - return false; + if (branchTarget != loop->getBreakBlock()) + continue; if (findBreakableRegionHeaderInst(context.domTree, block) != loop) { // If the break is initiated from a nested region, this is not trivial. -- cgit v1.2.3