Skip to content

Commit

Permalink
Fix target switch lowering bug. (#5182)
Browse files Browse the repository at this point in the history
  • Loading branch information
csyonghe authored Sep 28, 2024
1 parent c55805e commit 24f56d0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion source/slang/slang-lower-to-ir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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*)
Expand Down

0 comments on commit 24f56d0

Please sign in to comment.