From e0a856b8f101ad66159fa9779c36fcc723f611f6 Mon Sep 17 00:00:00 2001 From: Sai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com> Date: Thu, 20 Jul 2023 18:59:51 -0400 Subject: Fix issue with loop elimination not working on certain side-effect-free loops (#3005) Co-authored-by: Yong He --- source/slang/slang-ir-simplify-cfg.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/slang/slang-ir-simplify-cfg.cpp b/source/slang/slang-ir-simplify-cfg.cpp index ab332fd1b..c4c5b584e 100644 --- a/source/slang/slang-ir-simplify-cfg.cpp +++ b/source/slang/slang-ir-simplify-cfg.cpp @@ -176,7 +176,9 @@ static bool doesLoopHasSideEffect(IRGlobalValueWithCode* func, IRLoop* loopInst) if (auto call = as(inst)) { auto callee = getResolvedInstForDecorations(call->getCallee()); - if (!callee || !callee->findDecoration()) + if (!callee || + !(callee->findDecoration() || + callee->findDecoration())) return true; // We are calling a pure function, check if any of the return // variables are used outside the loop. -- cgit v1.2.3