| ... | @@ -33930,6 +33930,17 @@ fn resolvePeerTypes( | ... | @@ -33930,6 +33930,17 @@ fn resolvePeerTypes( |
| 33930 | else => {}, | 33930 | else => {}, |
| 33931 | } | 33931 | } |
| 33932 | | 33932 | |
| | 33933 | // Fast path: check if everything has the same type to bypass the main PTR logic. |
| | 33934 | same_type: { |
| | 33935 | const ty = sema.typeOf(instructions[0]); |
| | 33936 | for (instructions[1..]) |inst| { |
| | 33937 | if (sema.typeOf(inst).toIntern() != ty.toIntern()) { |
| | 33938 | break :same_type; |
| | 33939 | } |
| | 33940 | } |
| | 33941 | return ty; |
| | 33942 | } |
| | 33943 | |
| 33933 | const peer_tys = try sema.arena.alloc(?Type, instructions.len); | 33944 | const peer_tys = try sema.arena.alloc(?Type, instructions.len); |
| 33934 | const peer_vals = try sema.arena.alloc(?Value, instructions.len); | 33945 | const peer_vals = try sema.arena.alloc(?Value, instructions.len); |
| 33935 | | 33946 | |