summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-specialize-address-space.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-07-25 15:00:14 -0700
committerGitHub <noreply@github.com>2024-07-25 15:00:14 -0700
commitc9d89a40775a055873adf82cfb0ee1cb6bdcb93c (patch)
tree2438f353e87b30febe966ca23976793637c018d2 /source/slang/slang-ir-specialize-address-space.cpp
parent1343ab79fcd0ff9e5ffebbcf95414e51ab19e9cd (diff)
Overhaul IR lowering of pointer types. (#4710)
* Overhaul IR lowering of pointer types. * Propagate address space in IRBuilder. * Fixup. * Fix. * Fix. * Change how Ptr type is printed to text. * Fix.
Diffstat (limited to 'source/slang/slang-ir-specialize-address-space.cpp')
-rw-r--r--source/slang/slang-ir-specialize-address-space.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/source/slang/slang-ir-specialize-address-space.cpp b/source/slang/slang-ir-specialize-address-space.cpp
index 1d899e240..24eee3d76 100644
--- a/source/slang/slang-ir-specialize-address-space.cpp
+++ b/source/slang/slang-ir-specialize-address-space.cpp
@@ -331,9 +331,12 @@ namespace Slang
auto ptrType = as<IRPtrTypeBase>(inst->getDataType());
if (ptrType)
{
- IRBuilder builder(inst);
- auto newType = builder.getPtrType(ptrType->getOp(), ptrType->getValueType(), addrSpace);
- setDataType(inst, newType);
+ if (ptrType->getAddressSpace() != addrSpace)
+ {
+ IRBuilder builder(inst);
+ auto newType = builder.getPtrType(ptrType->getOp(), ptrType->getValueType(), addrSpace);
+ setDataType(inst, newType);
+ }
}
}
}