diff options
Diffstat (limited to 'source/slang/slang-ir-specialize-dynamic-associatedtype-lookup.cpp')
| -rw-r--r-- | source/slang/slang-ir-specialize-dynamic-associatedtype-lookup.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source/slang/slang-ir-specialize-dynamic-associatedtype-lookup.cpp b/source/slang/slang-ir-specialize-dynamic-associatedtype-lookup.cpp index e2d321ed4..670202161 100644 --- a/source/slang/slang-ir-specialize-dynamic-associatedtype-lookup.cpp +++ b/source/slang/slang-ir-specialize-dynamic-associatedtype-lookup.cpp @@ -122,7 +122,18 @@ struct AssociatedTypeLookupSpecializationContext { // Ignore lookups for RTTI objects for now, since they are not used anywhere. if (!as<IRWitnessTableType>(inst->getDataType())) + { + IRBuilder builder; + builder.sharedBuilder = &sharedContext->sharedBuilderStorage; + builder.setInsertBefore(inst); + auto uint2Type = builder.getVectorType( + builder.getUIntType(), builder.getIntValue(builder.getIntType(), 2)); + auto zero = builder.getIntValue(builder.getUIntType(), 0); + IRInst* args[] = { zero, zero }; + auto zeroUint2 = builder.emitMakeVector(uint2Type, 2, args); + inst->replaceUsesWith(zeroUint2); return; + } // Replace all witness table lookups with calls to specialized functions that directly // returns the sequential ID of the resulting witness table, effectively getting rid @@ -165,7 +176,7 @@ struct AssociatedTypeLookupSpecializationContext { // If the operand is a witness table, it is already replaced with a uint2 // at this point, where the first element in the uint2 is the id of the - // witneess table. + // witness table. auto vectorType = inst->getRTTIOperand()->getDataType(); IRBuilder builder; builder.sharedBuilder = &sharedContext->sharedBuilderStorage; |
