From a9f2f8a592c4514cd116c947486055788092ea56 Mon Sep 17 00:00:00 2001 From: Sai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com> Date: Tue, 25 Feb 2025 10:42:19 -0800 Subject: Fix `UseGraph::replace` (#6395) * Fix `UseGraph::isTrivial()` test. * Fix. * Fix. * Refactor `UseGraph` and `UseChain` * Update slang-ir-autodiff-primal-hoist.cpp * Update all auto-diff locations that handle pointers to treat user pointers as regular values * Update test to use direct-SPIRV only --------- Co-authored-by: Yong He --- source/slang/slang-ir-util.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'source/slang/slang-ir-util.cpp') diff --git a/source/slang/slang-ir-util.cpp b/source/slang/slang-ir-util.cpp index dbd6ac099..bf5b25d9c 100644 --- a/source/slang/slang-ir-util.cpp +++ b/source/slang/slang-ir-util.cpp @@ -1528,6 +1528,16 @@ bool isOne(IRInst* inst) } } +IRPtrTypeBase* asRelevantPtrType(IRInst* inst) +{ + if (auto ptrType = as(inst)) + { + if (ptrType->getAddressSpace() != AddressSpace::UserPointer) + return ptrType; + } + return nullptr; +} + IRPtrTypeBase* isMutablePointerType(IRInst* inst) { switch (inst->getOp()) @@ -1535,7 +1545,7 @@ IRPtrTypeBase* isMutablePointerType(IRInst* inst) case kIROp_ConstRefType: return nullptr; default: - return as(inst); + return asRelevantPtrType(inst); } } -- cgit v1.2.3