summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2021-09-01 16:00:06 -0700
committerGitHub <noreply@github.com>2021-09-01 16:00:06 -0700
commitcaf46421fcc6792dd2ab991752b6a97b44ba0431 (patch)
tree3fcdb4cc34399339ffa0d35b22698416f94c50da /source
parent09e32c11b6cd77acbe1b1f6e865c861932433b1d (diff)
Bug fix for createDynamicObject (#1927)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-ir-lower-existential.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/source/slang/slang-ir-lower-existential.cpp b/source/slang/slang-ir-lower-existential.cpp
index ac46fa46f..7cbb1b372 100644
--- a/source/slang/slang-ir-lower-existential.cpp
+++ b/source/slang/slang-ir-lower-existential.cpp
@@ -65,7 +65,11 @@ namespace Slang
auto anyValueType = cast<IRAnyValueType>(tupleType->getOperand(2));
// Create a null value for `rttiObject` for now since it will not be used.
- IRInst* rttiObject = builder->getIntValue(builder->getIntType(), 0);
+ auto uint2Type = builder->getVectorType(
+ builder->getUIntType(), builder->getIntValue(builder->getIntType(), 2));
+ IRInst* zero = builder->getIntValue(builder->getUIntType(), 0);
+ IRInst* zeroVectorArgs[] = { zero, zero };
+ IRInst* rttiObject = builder->emitMakeVector(uint2Type, 2, zeroVectorArgs);
// Pack the user provided value into `AnyValue`.
IRInst* packedValue = inst->getValue();
@@ -78,8 +82,7 @@ namespace Slang
// a `uint2` value from `typeID` to stay consistent with the convention.
IRInst* vectorArgs[2] = {
inst->getTypeID(), builder->getIntValue(builder->getUIntType(), 0)};
- auto uint2Type = builder->getVectorType(
- builder->getUIntType(), builder->getIntValue(builder->getIntType(), 2));
+
IRInst* typeIdValue = builder->emitMakeVector(uint2Type, 2, vectorArgs);
typeIdValue = builder->emitBitCast(witnessTableIdType, typeIdValue);
IRInst* tupleArgs[] = {rttiObject, typeIdValue, packedValue};