From 2f422087ed04940f6b6b351605e61d48ce1989ce Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 10 Jan 2023 12:42:55 -0800 Subject: Nested bwd-diff func call context save/restore. (#2584) Co-authored-by: Yong He --- source/slang/slang-ir.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'source/slang/slang-ir.cpp') diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp index 9e0e328bd..f37a7a1a0 100644 --- a/source/slang/slang-ir.cpp +++ b/source/slang/slang-ir.cpp @@ -6526,7 +6526,7 @@ namespace Slang // By default, assume that we might have side effects, // to safely cover all the instructions we haven't had time to think about. default: - return true; + break; case kIROp_Call: { @@ -6553,7 +6553,7 @@ namespace Slang return false; } } - return true; + break; // All of the cases for "global values" are side-effect-free. case kIROp_StructType: @@ -6665,6 +6665,13 @@ namespace Slang case kIROp_BackwardDifferentiate: return false; } + + // Check if the calle has been marked with a catch-all no-side-effect decoration. + if (findDecoration()) + { + return false; + } + return true; } IRModule* IRInst::getModule() -- cgit v1.2.3