| ... | @@ -2452,7 +2452,11 @@ fn airSwitchBr(self: *Self, inst: Air.Inst.Index) InnerError!WValue { | ... | @@ -2452,7 +2452,11 @@ fn airSwitchBr(self: *Self, inst: Air.Inst.Index) InnerError!WValue { |
| 2452 | if (case_value.integer == value) break :blk @intCast(u32, idx); | 2452 | if (case_value.integer == value) break :blk @intCast(u32, idx); |
| 2453 | } | 2453 | } |
| 2454 | } | 2454 | } |
| 2455 | break :blk if (has_else_body) case_i else unreachable; | 2455 | // error sets are almost always sparse so we use the default case |
| | 2456 | // for errors that are not present in any branch. This is fine as this default |
| | 2457 | // case will never be hit for those cases but we do save runtime cost and size |
| | 2458 | // by using a jump table for this instead of if-else chains. |
| | 2459 | break :blk if (has_else_body or target_ty.zigTypeTag() == .ErrorSet) case_i else unreachable; |
| 2456 | }; | 2460 | }; |
| 2457 | self.mir_extra.appendAssumeCapacity(idx); | 2461 | self.mir_extra.appendAssumeCapacity(idx); |
| 2458 | } else if (has_else_body) { | 2462 | } else if (has_else_body) { |