summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2020-10-04 01:40:58 -0700
committerGitHub <noreply@github.com>2020-10-04 01:40:58 -0700
commit3321df74904dfe3a11a41179b66a4c3ce5b57022 (patch)
tree2644bd8c0dcb3cdd148042745ed2fb7c51cd91ed /source/slang/slang-ir.cpp
parent24ecd1fa2f37f3c4949989b53562e8f85833a8f6 (diff)
Handle partial existential parameter type specialization. (#1568)
* Specialize exsitentials parameters in struct fields. * Cleanup. * Handle partial existential parameter type specialization. Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ir.cpp')
-rw-r--r--source/slang/slang-ir.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp
index e9d90adfe..3820119d2 100644
--- a/source/slang/slang-ir.cpp
+++ b/source/slang/slang-ir.cpp
@@ -2336,10 +2336,14 @@ namespace Slang
operands);
}
- IRExistentialBoxType* IRBuilder::getExistentialBoxType(IRType* concreteType, IRType* interfaceType)
+ IRType* IRBuilder::getExistentialBoxType(IRType* concreteType, IRType* interfaceType)
{
+ // Don't wrap an existential box if concreteType is __Dynamic.
+ if (as<IRDynamicType>(concreteType))
+ return interfaceType;
+
IRInst* operands[] = {concreteType, interfaceType};
- return (IRExistentialBoxType*)getType(kIROp_ExistentialBoxType, 2, operands);
+ return getType(kIROp_ExistentialBoxType, 2, operands);
}
IRArrayTypeBase* IRBuilder::getArrayTypeBase(
@@ -2845,6 +2849,8 @@ namespace Slang
// We want to emit `makeExistential(load(value), witnessTable)`.
//
auto deref = emitLoad(value);
+ if (slotArgs[0]->op == kIROp_DynamicType)
+ return deref;
return emitMakeExistential(type, deref, slotArgs[1]);
}
}