From 271dc1b98d3887b6297c5407dc67692716687f4d Mon Sep 17 00:00:00 2001 From: Sai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com> Date: Sat, 6 May 2023 03:03:25 -0400 Subject: Don't store loop induction values + fix minor issue (#2872) --- source/slang/slang-ir-autodiff.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'source/slang/slang-ir-autodiff.cpp') diff --git a/source/slang/slang-ir-autodiff.cpp b/source/slang/slang-ir-autodiff.cpp index f6a977994..6d56736ad 100644 --- a/source/slang/slang-ir-autodiff.cpp +++ b/source/slang/slang-ir-autodiff.cpp @@ -1909,7 +1909,7 @@ IRUse* findUniqueStoredVal(IRVar* var) // the final value to it, this method will return the call inst for this case. IRUse* findLatestUniqueWriteUse(IRVar* var) { - IRUse* storeUse = nullptr; + IRUse* callUse = nullptr; for (auto use = var->firstUse; use; use = use->nextUse) { if (const auto callInst = as(use->getUser())) @@ -1917,10 +1917,14 @@ IRUse* findLatestUniqueWriteUse(IRVar* var) // Ignore uses from differential blocks. if (callInst->getParent()->findDecoration()) continue; - SLANG_RELEASE_ASSERT(!storeUse); - storeUse = use; + SLANG_RELEASE_ASSERT(!callUse); + callUse = use; } } + + if (callUse) + return callUse; + // If no unique call found, try to look for a store. return findUniqueStoredVal(var); } -- cgit v1.2.3