summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir.cpp
diff options
context:
space:
mode:
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()