| ... | ... | @@ -23195,14 +23195,19 @@ static IrInstruction *ir_analyze_ptr_cast(IrAnalyze *ira, IrInstruction *source_ |
| 23195 | 23195 | } |
| 23196 | 23196 | } |
| 23197 | 23197 | |
| 23198 | | IrInstruction *result = ir_const(ira, source_instr, dest_type); |
| 23198 | IrInstruction *result; |
| 23199 | if (ptr->value.data.x_ptr.mut == ConstPtrMutInfer) { |
| 23200 | result = ir_build_ptr_cast_gen(ira, source_instr, dest_type, ptr, safety_check_on); |
| 23201 | } else { |
| 23202 | result = ir_const(ira, source_instr, dest_type); |
| 23203 | } |
| 23199 | 23204 | copy_const_val(&result->value, val, true); |
| 23200 | 23205 | result->value.type = dest_type; |
| 23201 | 23206 | |
| 23202 | 23207 | // Keep the bigger alignment, it can only help- |
| 23203 | 23208 | // unless the target is zero bits. |
| 23204 | 23209 | if (src_align_bytes > dest_align_bytes && type_has_bits(dest_type)) { |
| 23205 | | result = ir_align_cast(ira, result, src_align_bytes, false); |
| 23210 | result = ir_align_cast(ira, result, src_align_bytes, false); |
| 23206 | 23211 | } |
| 23207 | 23212 | |
| 23208 | 23213 | return result; |