summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-ir.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-ir.cpp')
-rw-r--r--source/slang/slang-ir.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp
index ebaebcc8a..ba8864684 100644
--- a/source/slang/slang-ir.cpp
+++ b/source/slang/slang-ir.cpp
@@ -6187,14 +6187,12 @@ IRInst* IRBuilder::emitCastStorageToLogical(IRType* type, IRInst* val, IRInst* b
return (IRCastStorageToLogical*)emitIntrinsicInst(type, kIROp_CastStorageToLogical, 2, args);
}
-IRCastStorageToLogicalDeref* IRBuilder::emitCastStorageToLogicalDeref(
- IRType* type,
- IRInst* val,
- IRInst* bufferType)
+IRInst* IRBuilder::emitCastStorageToLogicalDeref(IRType* type, IRInst* val, IRInst* bufferType)
{
IRInst* args[] = {val, bufferType};
- return (IRCastStorageToLogicalDeref*)
- emitIntrinsicInst(type, kIROp_CastStorageToLogicalDeref, 2, args);
+ if (type == tryGetPointedToType(this, val->getDataType()))
+ return emitLoad(type, val);
+ return emitIntrinsicInst(type, kIROp_CastStorageToLogicalDeref, 2, args);
}
IRGlobalConstant* IRBuilder::emitGlobalConstant(IRType* type)