summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-lower-generic-call.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-ir-lower-generic-call.cpp')
-rw-r--r--source/slang/slang-ir-lower-generic-call.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/source/slang/slang-ir-lower-generic-call.cpp b/source/slang/slang-ir-lower-generic-call.cpp
index 3571b7a27..7669593c6 100644
--- a/source/slang/slang-ir-lower-generic-call.cpp
+++ b/source/slang/slang-ir-lower-generic-call.cpp
@@ -218,9 +218,6 @@ namespace Slang
auto newCall = builder->emitCallInst(calleeRetType, newCallee, args);
auto callInstType = callInst->getDataType();
auto unpackInst = maybeUnpackValue(builder, callInstType, calleeRetType, newCall);
- callInst->replaceUsesWith(unpackInst);
- callInst->removeAndDeallocate();
-
// Unpack other `out` arguments.
for (auto& item : argsToUnpack)
{
@@ -229,6 +226,8 @@ namespace Slang
auto unpackedVal = builder->emitUnpackAnyValue(originalValType, packedVal);
builder->emitStore(item.dstArg, unpackedVal);
}
+ callInst->replaceUsesWith(unpackInst);
+ callInst->removeAndDeallocate();
}
IRInst* findInnerMostSpecializingBase(IRSpecialize* inst)