From 4c4826d47eeef4675daae4ae53ff76f4d5ebd84a Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 16 Feb 2023 13:55:32 -0800 Subject: Overhaul global inst deduplication and cpp/cuda backend. (#2654) * Overhaul global inst deduplication and cpp/cuda backend. * Update IR documentation. --------- Co-authored-by: Yong He --- source/slang/slang-ir-specialize.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'source/slang/slang-ir-specialize.cpp') diff --git a/source/slang/slang-ir-specialize.cpp b/source/slang/slang-ir-specialize.cpp index cf7acd46c..0044e5745 100644 --- a/source/slang/slang-ir-specialize.cpp +++ b/source/slang/slang-ir-specialize.cpp @@ -897,7 +897,8 @@ struct SpecializationContext // specialization opportunities (generic specialization, // existential specialization, simplifications, etc.) // - iterChanged |= maybeSpecializeInst(inst); + if (inst->hasUses() || inst->mightHaveSideEffects()) + iterChanged |= maybeSpecializeInst(inst); // Finally, we need to make our logic recurse through // the whole IR module, so we want to add the children @@ -1041,7 +1042,6 @@ struct SpecializationContext // The old callee should be in the form of `specialize(.operator[], IInterfaceType)`, // we should update it to be `specialize(.operator[], elementType)`, so the return type // of the load call is `elementType`. - auto oldCallee = inst->getCallee(); // A subscript operation on mutable buffers returns a ptr type instead of a value type. // We need to make sure the pointer-ness is preserved correctly. @@ -1057,9 +1057,6 @@ struct SpecializationContext inst->replaceUsesWith(newWrapExistential); workList.Remove(inst); inst->removeAndDeallocate(); - SLANG_ASSERT(!oldCallee->hasUses()); - workList.Remove(oldCallee); - oldCallee->removeAndDeallocate(); addUsersToWorkList(newWrapExistential); workList.Remove(wrapExistential); -- cgit v1.2.3