diff options
Diffstat (limited to 'source/slang/slang-ir-addr-inst-elimination.cpp')
| -rw-r--r-- | source/slang/slang-ir-addr-inst-elimination.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/slang/slang-ir-addr-inst-elimination.cpp b/source/slang/slang-ir-addr-inst-elimination.cpp index 4d44aac1f..6fb21e1ef 100644 --- a/source/slang/slang-ir-addr-inst-elimination.cpp +++ b/source/slang/slang-ir-addr-inst-elimination.cpp @@ -97,6 +97,12 @@ struct AddressInstEliminationContext auto addr = use->get(); auto call = as<IRCall>(use->getUser()); + // Don't change the use if addr is a non mutable address. + if (auto refType = as<IRConstRefType>(getRootAddr(addr)->getDataType())) + { + return; + } + IRBuilder builder(module); builder.setInsertBefore(call); auto tempVar = builder.emitVar(cast<IRPtrTypeBase>(addr->getFullType())->getValueType()); @@ -123,6 +129,8 @@ struct AddressInstEliminationContext { for (auto inst : block->getChildren()) { + if (as<IRConstRefType>(getRootAddr(inst)->getDataType())) + continue; if (auto ptrType = as<IRPtrTypeBase>(inst->getDataType())) { auto valType = unwrapAttributedType(ptrType->getValueType()); |
