summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-ir-specialize.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-02-16 13:55:32 -0800
committerGitHub <noreply@github.com>2023-02-16 13:55:32 -0800
commit4c4826d47eeef4675daae4ae53ff76f4d5ebd84a (patch)
treeed4af0ded878e4f06e9641ce61d26ffd7c89ccbc /source/slang/slang-ir-specialize.cpp
parenteda88e513e8b1e2abc05e9dc8555f237d96472df (diff)
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 <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ir-specialize.cpp')
-rw-r--r--source/slang/slang-ir-specialize.cpp7
1 files changed, 2 insertions, 5 deletions
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);