| ... | @@ -11187,6 +11187,13 @@ static IrInstruction *ir_get_deref(IrAnalyze *ira, IrInstruction *source_instruc | ... | @@ -11187,6 +11187,13 @@ static IrInstruction *ir_get_deref(IrAnalyze *ira, IrInstruction *source_instruc |
| 11187 | } | 11187 | } |
| 11188 | } | 11188 | } |
| 11189 | } | 11189 | } |
| | 11190 | // dereferencing a *u0 is comptime known to be 0 |
| | 11191 | if (child_type->id == ZigTypeIdInt && child_type->data.integral.bit_count == 0) { |
| | 11192 | IrInstruction *result = ir_create_const(&ira->new_irb, source_instruction->scope, |
| | 11193 | source_instruction->source_node, child_type); |
| | 11194 | init_const_unsigned_negative(&result->value, child_type, 0, false); |
| | 11195 | return result; |
| | 11196 | } |
| 11190 | // TODO if the instruction is a const ref instruction we can skip it | 11197 | // TODO if the instruction is a const ref instruction we can skip it |
| 11191 | IrInstruction *load_ptr_instruction = ir_build_load_ptr(&ira->new_irb, source_instruction->scope, | 11198 | IrInstruction *load_ptr_instruction = ir_build_load_ptr(&ira->new_irb, source_instruction->scope, |
| 11192 | source_instruction->source_node, ptr); | 11199 | source_instruction->source_node, ptr); |