diff options
| author | Yong He <yonghe@outlook.com> | 2022-06-01 22:29:10 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-01 22:29:10 -0700 |
| commit | bc6bc56db51d06b92dc63ef9c9e0def6c9760c9e (patch) | |
| tree | 55aae1b64e3c0befe4b424764f6f0064701a9ffe /source/slang/slang-emit-spirv.cpp | |
| parent | 4f14efc9752d9ebc8538a2e29ed154a00dc99682 (diff) | |
Clean up void returns. (#2260)
* Clean up `IRReturnVoid`.
* Update gitignore.
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-emit-spirv.cpp')
| -rw-r--r-- | source/slang/slang-emit-spirv.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/source/slang/slang-emit-spirv.cpp b/source/slang/slang-emit-spirv.cpp index 6b3b42e92..fa0d92512 100644 --- a/source/slang/slang-emit-spirv.cpp +++ b/source/slang/slang-emit-spirv.cpp @@ -1619,11 +1619,16 @@ struct SPIRVEmitContext case kIROp_Rsh: case kIROp_Lsh: return emitArithmetic(parent, inst); - case kIROp_ReturnVal: - return emitInst( - parent, inst, SpvOpReturnValue, as<IRReturnVal>(inst)->getVal()); - case kIROp_ReturnVoid: - return emitInst(parent, inst, SpvOpReturn); + case kIROp_Return: + if (as<IRReturn>(inst)->getVal()->getOp() == kIROp_VoidLit) + { + return emitInst(parent, inst, SpvOpReturn); + } + else + { + return emitInst( + parent, inst, SpvOpReturnValue, as<IRReturn>(inst)->getVal()); + } case kIROp_discard: return emitInst(parent, inst, SpvOpKill); case kIROp_unconditionalBranch: |
