| ... | ... | @@ -3480,8 +3480,9 @@ static LLVMValueRef ir_render_widen_or_shorten(CodeGen *g, IrExecutableGen *exec |
| 3480 | 3480 | static LLVMValueRef ir_render_int_to_ptr(CodeGen *g, IrExecutableGen *executable, IrInstGenIntToPtr *instruction) { |
| 3481 | 3481 | ZigType *wanted_type = instruction->base.value->type; |
| 3482 | 3482 | LLVMValueRef target_val = ir_llvm_value(g, instruction->target); |
| 3483 | const uint32_t align_bytes = get_ptr_align(g, wanted_type); |
| 3483 | 3484 | |
| 3484 | | if (ir_want_runtime_safety(g, &instruction->base)) { |
| 3485 | if (ir_want_runtime_safety(g, &instruction->base) && align_bytes > 1) { |
| 3485 | 3486 | ZigType *usize = g->builtin_types.entry_usize; |
| 3486 | 3487 | LLVMValueRef zero = LLVMConstNull(usize->llvm_type); |
| 3487 | 3488 | |
| ... | ... | @@ -3498,7 +3499,6 @@ static LLVMValueRef ir_render_int_to_ptr(CodeGen *g, IrExecutableGen *executable |
| 3498 | 3499 | } |
| 3499 | 3500 | |
| 3500 | 3501 | { |
| 3501 | | const uint32_t align_bytes = get_ptr_align(g, wanted_type); |
| 3502 | 3502 | LLVMValueRef alignment_minus_1 = LLVMConstInt(usize->llvm_type, align_bytes - 1, false); |
| 3503 | 3503 | LLVMValueRef anded_val = LLVMBuildAnd(g->builder, target_val, alignment_minus_1, ""); |
| 3504 | 3504 | LLVMValueRef is_ok_bit = LLVMBuildICmp(g->builder, LLVMIntEQ, anded_val, zero, ""); |