From 259a015feb9d4ab65e8fbba32f6c777e92780cc7 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 22 Mar 2023 21:16:35 -0700 Subject: Type legalization and autodiff bug fixes. (#2722) * Bug fixes. * Fix. * Only perform autodiff for functions whose derivative is actually used. * Fix loop optimize bug. * Fix high order diff. * Fix trivial diff func generation. * Fixes. * Cleanup. --------- Co-authored-by: Yong He --- source/slang/slang-ir-clone.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'source/slang/slang-ir-clone.cpp') diff --git a/source/slang/slang-ir-clone.cpp b/source/slang/slang-ir-clone.cpp index 050d1e392..6ac9442ee 100644 --- a/source/slang/slang-ir-clone.cpp +++ b/source/slang/slang-ir-clone.cpp @@ -142,12 +142,9 @@ static void _cloneInstDecorationsAndChildren( // If `newInst` already has non-decoration children, we want to // insert the new children between the existing decoration and non-decoration children // so that we maintain the invariant that all decorations are defined before non-decorations. - if (auto lastDecor = newInst->getLastDecoration()) + if (auto firstChild = newInst->getFirstChild()) { - if (auto nextInstBeforeLastDecor = lastDecor->getNextInst()) - { - builder->setInsertBefore(nextInstBeforeLastDecor); - } + builder->setInsertBefore(firstChild); } // When applying the first phase of cloning to -- cgit v1.2.3