diff options
| author | Yong He <yonghe@outlook.com> | 2024-09-27 19:28:58 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-27 19:28:58 -0700 |
| commit | 24f56d0d0e00853709f9a51da593928eb3460f60 (patch) | |
| tree | 6ba625bc6c5b38a5ab700d4b39476434653727cc /source | |
| parent | c55805e9c6dc3a44e3983fea4245cb00d4e318d5 (diff) | |
Fix target switch lowering bug. (#5182)
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/slang-lower-to-ir.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp index d8dbaa812..e677c24dd 100644 --- a/source/slang/slang-lower-to-ir.cpp +++ b/source/slang/slang-lower-to-ir.cpp @@ -6622,8 +6622,13 @@ struct StmtLoweringVisitor : StmtVisitor<StmtLoweringVisitor> } context->shared->breakLabels.remove(stmt); builder->setInsertInto(initialBlock); + + auto parentFunc = initialBlock->getParent(); + parentFunc->addBlock(breakLabel); + builder->emitIntrinsicInst(nullptr, kIROp_TargetSwitch, (UInt)args.getCount(), args.getBuffer()); - insertBlock(breakLabel); + + builder->setInsertInto(breakLabel); } void visitTargetCaseStmt(TargetCaseStmt*) |
