diff options
| author | Yong He <yonghe@outlook.com> | 2021-09-03 01:57:31 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-03 01:57:31 -0700 |
| commit | 0a81d11bc06e55089f7061225b9553329f697828 (patch) | |
| tree | 31cc310eeb7cae68a5e3e49d882578da7e565dde /source/slang/slang-ir-lower-generic-call.cpp | |
| parent | cf7dddae74ae990c2b46a9feeaea3b7a33ec077d (diff) | |
Fix crash: dynamic dispatch of generic interface method. (#1929)
* Fix crash: dynamic dispatch of generic interface method.
* Fix memory error.
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ir-lower-generic-call.cpp')
| -rw-r--r-- | source/slang/slang-ir-lower-generic-call.cpp | 5 |
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) |
