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.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp
index f37a7a1a0..b36a2ebec 100644
--- a/source/slang/slang-ir.cpp
+++ b/source/slang/slang-ir.cpp
@@ -2810,6 +2810,8 @@ namespace Slang
IRBackwardDiffIntermediateContextType* IRBuilder::getBackwardDiffIntermediateContextType(
IRInst* func)
{
+ if (!func)
+ func = getVoidValue();
return (IRBackwardDiffIntermediateContextType*)getType(
kIROp_BackwardDiffIntermediateContextType,
1,
@@ -6260,6 +6262,8 @@ namespace Slang
return type;
}
+ void validateIRInstOperands(IRInst*);
+
void IRInst::replaceUsesWith(IRInst* other)
{
// Safety check: don't try to replace something with itself.
@@ -6377,6 +6381,10 @@ namespace Slang
this->prev = inPrev;
this->next = inNext;
this->parent = inParent;
+
+#if _DEBUG
+ validateIRInstOperands(this);
+#endif
}
void IRInst::insertAfter(IRInst* other)