summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-util.cpp
diff options
context:
space:
mode:
authorSai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com>2025-02-25 10:42:19 -0800
committerGitHub <noreply@github.com>2025-02-25 10:42:19 -0800
commita9f2f8a592c4514cd116c947486055788092ea56 (patch)
treee7bb9fba9d80631254ea1b42a96fe2c201573979 /source/slang/slang-ir-util.cpp
parent19083925690f6180cb081ce2be4fbbdb64010b37 (diff)
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 <yonghe@outlook.com>
Diffstat (limited to 'source/slang/slang-ir-util.cpp')
-rw-r--r--source/slang/slang-ir-util.cpp12
1 files changed, 11 insertions, 1 deletions
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<IRPtrTypeBase>(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<IRPtrTypeBase>(inst);
+ return asRelevantPtrType(inst);
}
}