Skip to content

Commit c2168c6

Browse files
committed
[MERGE #6072 @MikeHolman] make EndSwitch flush cases to the EndSwitch offset
Merge pull request #6072 from MikeHolman:endswitchbug This makes it so that if targetOffset is breaking out of a loop we won't have problems (could happen in wasm). Now cases will go to EndSwitch, which just does direct branch to targetOffset. In normal cases, that will be cleaned up by RetargetBrToBr peep, so codegen doesn't change. Fixes #6037
2 parents 2e1aa48 + 524b9b0 commit c2168c6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/Backend/SwitchIRBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ SwitchIRBuilder::BeginSwitch()
163163
void
164164
SwitchIRBuilder::EndSwitch(uint32 offset, uint32 targetOffset)
165165
{
166-
FlushCases(targetOffset);
166+
FlushCases(offset);
167167
AssertMsg(m_caseNodes->Count() == 0, "Not all switch case nodes built by end of switch");
168168

169169
// only generate the final unconditional jump at the end of the switch

0 commit comments

Comments
 (0)