diff options
| author | Yong He <yonghe@outlook.com> | 2025-10-09 18:30:24 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-10 01:30:24 +0000 |
| commit | e420f2f980813559b186a6a6bcd5540f74310d02 (patch) | |
| tree | 8f7a833ed86e8ce2a7b40bd1e9e7da5cb95d66ab /source/slang/slang-ir.cpp | |
| parent | 3cf1f5a616917480c63b76aae906dc36b29e46ce (diff) | |
Defer `IRCastStorageToLogicalDeref` in lowerBufferElementType pass. (#8668)
Fix a regression on metal test.
In `lowerBufferElementTypeToStorageType` pass, not only we want to defer
an argument that is `CastStorageToLogical` to the callee, but also apply
the same defer logic to `CastStorageToLogicalDeref` as well.
Because `CastStorageToLogicalDeref` will appear as argumnet if
`lowerBufferElementTypeToStorageType` is run before we apply the
`in->borrow` transformation pass, which is the case for metal parameter
block legalization.
Diffstat (limited to 'source/slang/slang-ir.cpp')
| -rw-r--r-- | source/slang/slang-ir.cpp | 10 |
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) |
