diff options
| author | Yong He <yonghe@outlook.com> | 2023-09-03 12:56:31 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-03 12:56:31 -0700 |
| commit | 1d4b5b6fd2433a10cc7ab87626cb560f54b0acbb (patch) | |
| tree | 6196d519190720fd2968ac7d4b373e3c967d5fe6 /source/slang/slang-emit-c-like.cpp | |
| parent | 355bb4287861f96082751042f4e58ff3598b4e5e (diff) | |
Proper lowering of functiosn that returns NonCopyable values. (#3179)
* Proper lowering of functiosn that returns NonCopyable values.
* Fix tests.
* Fix clang errors.
* Fix.
* Fix clang error.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-emit-c-like.cpp')
| -rw-r--r-- | source/slang/slang-emit-c-like.cpp | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/source/slang/slang-emit-c-like.cpp b/source/slang/slang-emit-c-like.cpp index fe25c3f19..a8080851f 100644 --- a/source/slang/slang-emit-c-like.cpp +++ b/source/slang/slang-emit-c-like.cpp @@ -1535,25 +1535,6 @@ bool CLikeSourceEmitter::shouldFoldInstIntoUseSites(IRInst* inst) if(as<IRUnconditionalBranch>(user)) return false; - // HACK: As a special case, an `allocateOpaqueHandle` operation should - // only be folded in if its only use is as the operand of a `store` - // that will *itself* get peephole merged in as the initial-value expression - // of a `var`: - // - if (inst->getOp() == kIROp_AllocateOpaqueHandle) - { - auto store = as<IRStore>(user); - if (!store) return false; - if (store->getVal() != inst) return false; - - auto var = as<IRVar>(store->getPtr()); - if (!var) return false; - - if(var->getNextInst() != store) return false; - - return true; - } - // Okay, if we reach this point then the user comes later in // the same block, and there are no instructions with side // effects in between, so it seems safe to fold things in. @@ -2003,7 +1984,6 @@ void CLikeSourceEmitter::defaultEmitInstExpr(IRInst* inst, const EmitOpInfo& inO case kIROp_undefined: case kIROp_DefaultConstruct: - case kIROp_AllocateOpaqueHandle: m_writer->emit(getName(inst)); break; @@ -2676,11 +2656,7 @@ void CLikeSourceEmitter::_emitInst(IRInst* inst) break; case kIROp_AllocateOpaqueHandle: - { - _emitAllocateOpaqueHandleImpl(inst); - } break; - case kIROp_Var: { auto var = cast<IRVar>(inst); @@ -2875,11 +2851,6 @@ void CLikeSourceEmitter::_emitInstAsDefaultInitializedVar(IRInst* inst, IRType* m_writer->emit(";\n"); } -void CLikeSourceEmitter::_emitAllocateOpaqueHandleImpl(IRInst* allocateInst) -{ - _emitInstAsDefaultInitializedVar(allocateInst, allocateInst->getDataType()); -} - void CLikeSourceEmitter::emitSemanticsUsingVarLayout(IRVarLayout* varLayout) { if(auto semanticAttr = varLayout->findAttr<IRSemanticAttr>()) |
