summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-ir-lower-existential.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2020-08-26 15:05:59 -0700
committerGitHub <noreply@github.com>2020-08-26 15:05:59 -0700
commitec55ac4217eb5a9eedacc09888c846cd4b3a5add (patch)
treeda2d833eede0b5e5438a6a3c58305f16f79707a7 /source/slang/slang-ir-lower-existential.cpp
parent2dc1f89fb069decb93dbe950fed9665453303550 (diff)
Reorder existential tuple elements. (#1516)
Co-authored-by: Tim Foley <tim.foley.is@gmail.com>
Diffstat (limited to 'source/slang/slang-ir-lower-existential.cpp')
-rw-r--r--source/slang/slang-ir-lower-existential.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/source/slang/slang-ir-lower-existential.cpp b/source/slang/slang-ir-lower-existential.cpp
index 4078ad884..a6db2b781 100644
--- a/source/slang/slang-ir-lower-existential.cpp
+++ b/source/slang/slang-ir-lower-existential.cpp
@@ -25,7 +25,7 @@ namespace Slang
auto anyValueSize = sharedContext->getInterfaceAnyValueSize(interfaceType, inst->sourceLoc);
auto anyValueType = builder->getAnyValueType(anyValueSize);
auto rttiType = builder->getPtrType(builder->getRTTIType());
- auto tupleType = builder->getTupleType(anyValueType, witnessTableType, rttiType);
+ auto tupleType = builder->getTupleType(rttiType, witnessTableType, anyValueType);
IRInst* rttiObject = inst->getRTTI();
if (auto type = as<IRType>(rttiObject))
@@ -36,7 +36,7 @@ namespace Slang
IRInst* packedValue = value;
if (valueType->op != kIROp_AnyValueType)
packedValue = builder->emitPackAnyValue(anyValueType, value);
- IRInst* tupleArgs[] = { packedValue, inst->getWitnessTable(), rttiObject };
+ IRInst* tupleArgs[] = {rttiObject, inst->getWitnessTable(), packedValue};
auto tuple = builder->emitMakeTuple(tupleType, 3, tupleArgs);
inst->replaceUsesWith(tuple);
inst->removeAndDeallocate();
@@ -66,7 +66,7 @@ namespace Slang
void processExtractExistentialValue(IRExtractExistentialValue* inst)
{
- processExtractExistentialElement(inst, 0);
+ processExtractExistentialElement(inst, 2);
}
void processExtractExistentialWitnessTable(IRExtractExistentialWitnessTable* inst)
@@ -76,7 +76,7 @@ namespace Slang
void processExtractExistentialType(IRExtractExistentialType* inst)
{
- processExtractExistentialElement(inst, 2);
+ processExtractExistentialElement(inst, 0);
}
void processInst(IRInst* inst)