summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-01-10 12:42:55 -0800
committerGitHub <noreply@github.com>2023-01-10 12:42:55 -0800
commit2f422087ed04940f6b6b351605e61d48ce1989ce (patch)
tree522f8027173732d903a906081238b12863d73fb8 /source/slang/slang-ir.cpp
parenteb813fbd8750ed1ab66d73f5fa29ae8f2407e8af (diff)
Nested bwd-diff func call context save/restore. (#2584)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ir.cpp')
-rw-r--r--source/slang/slang-ir.cpp11
1 files changed, 9 insertions, 2 deletions
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<IRNoSideEffectDecoration>())
+ {
+ return false;
+ }
+ return true;
}
IRModule* IRInst::getModule()