diff options
Diffstat (limited to 'source/slang/slang-ir-link.cpp')
| -rw-r--r-- | source/slang/slang-ir-link.cpp | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/source/slang/slang-ir-link.cpp b/source/slang/slang-ir-link.cpp index a5130e8b6..56688abae 100644 --- a/source/slang/slang-ir-link.cpp +++ b/source/slang/slang-ir-link.cpp @@ -238,6 +238,7 @@ IRInst* IRSpecContext::maybeCloneValue(IRInst* originalValue) case kIROp_WitnessTable: case kIROp_InterfaceType: case kIROp_TaggedUnionType: + case kIROp_DifferentiableTypeDictionary: return cloneGlobalValue(this, originalValue); case kIROp_BoolLit: @@ -592,6 +593,24 @@ IRWitnessTable* cloneWitnessTableImpl( return clonedTable; } +IRInst* cloneDifferentiableTypeDictionary( + IRSpecContextBase* context, + IRBuilder* builder, + IRInst* originalDict, + IROriginalValuesForClone const& originalValues, + IRInst* dstDict = nullptr, + bool registerValue = true) +{ + IRInst* clonedDict = dstDict; + if (!clonedDict) + { + clonedDict = builder->emitDifferentiableTypeDictionary(); + } + cloneSimpleGlobalValueImpl(context, originalDict, originalValues, clonedDict, registerValue); + return clonedDict; +} + + IRWitnessTable* cloneWitnessTableWithoutRegistering( IRSpecContextBase* context, IRBuilder* builder, @@ -1118,6 +1137,9 @@ IRInst* cloneInst( case kIROp_GlobalGenericParam: return cloneGlobalGenericParamImpl(context, builder, cast<IRGlobalGenericParam>(originalInst), originalValues); + + case kIROp_DifferentiableTypeDictionary: + return cloneDifferentiableTypeDictionary(context, builder, originalInst, originalValues); default: break; @@ -1504,11 +1526,14 @@ LinkedIR linkIR( { for (auto inst : irModule->getGlobalInsts()) { - auto bindInst = as<IRBindGlobalGenericParam>(inst); - if (!bindInst) - continue; - - cloneValue(context, bindInst); + if (auto bindInst = as<IRBindGlobalGenericParam>(inst)) + { + cloneValue(context, bindInst); + } + else if (inst->getOp() == kIROp_DifferentiableTypeDictionary) + { + cloneValue(context, inst); + } } } |
