| ... | @@ -189,7 +189,8 @@ static IrInstruction *ir_analyze_bit_cast(IrAnalyze *ira, IrInstruction *source_ | ... | @@ -189,7 +189,8 @@ static IrInstruction *ir_analyze_bit_cast(IrAnalyze *ira, IrInstruction *source_ |
| 189 | static IrInstruction *ir_resolve_result_raw(IrAnalyze *ira, IrInstruction *suspend_source_instr, | 189 | static IrInstruction *ir_resolve_result_raw(IrAnalyze *ira, IrInstruction *suspend_source_instr, |
| 190 | ResultLoc *result_loc, ZigType *value_type, IrInstruction *value, bool force_runtime, bool non_null_comptime); | 190 | ResultLoc *result_loc, ZigType *value_type, IrInstruction *value, bool force_runtime, bool non_null_comptime); |
| 191 | static IrInstruction *ir_resolve_result(IrAnalyze *ira, IrInstruction *suspend_source_instr, | 191 | static IrInstruction *ir_resolve_result(IrAnalyze *ira, IrInstruction *suspend_source_instr, |
| 192 | ResultLoc *result_loc, ZigType *value_type, IrInstruction *value, bool force_runtime, bool non_null_comptime); | 192 | ResultLoc *result_loc, ZigType *value_type, IrInstruction *value, bool force_runtime, |
| | 193 | bool non_null_comptime, bool allow_discard); |
| 193 | static IrInstruction *ir_analyze_unwrap_optional_payload(IrAnalyze *ira, IrInstruction *source_instr, | 194 | static IrInstruction *ir_analyze_unwrap_optional_payload(IrAnalyze *ira, IrInstruction *source_instr, |
| 194 | IrInstruction *base_ptr, bool safety_check_on, bool initializing); | 195 | IrInstruction *base_ptr, bool safety_check_on, bool initializing); |
| 195 | static IrInstruction *ir_analyze_unwrap_error_payload(IrAnalyze *ira, IrInstruction *source_instr, | 196 | static IrInstruction *ir_analyze_unwrap_error_payload(IrAnalyze *ira, IrInstruction *source_instr, |
| ... | @@ -11163,7 +11164,8 @@ static IrInstruction *ir_resolve_ptr_of_array_to_slice(IrAnalyze *ira, IrInstruc | ... | @@ -11163,7 +11164,8 @@ static IrInstruction *ir_resolve_ptr_of_array_to_slice(IrAnalyze *ira, IrInstruc |
| 11163 | } | 11164 | } |
| 11164 | | 11165 | |
| 11165 | if (result_loc == nullptr) result_loc = no_result_loc(); | 11166 | if (result_loc == nullptr) result_loc = no_result_loc(); |
| 11166 | IrInstruction *result_loc_inst = ir_resolve_result(ira, source_instr, result_loc, wanted_type, nullptr, true, false); | 11167 | IrInstruction *result_loc_inst = ir_resolve_result(ira, source_instr, result_loc, wanted_type, nullptr, true, |
| | 11168 | false, true); |
| 11167 | if (type_is_invalid(result_loc_inst->value.type) || instr_is_unreachable(result_loc_inst)) { | 11169 | if (type_is_invalid(result_loc_inst->value.type) || instr_is_unreachable(result_loc_inst)) { |
| 11168 | return result_loc_inst; | 11170 | return result_loc_inst; |
| 11169 | } | 11171 | } |
| ... | @@ -11623,7 +11625,7 @@ static IrInstruction *ir_analyze_optional_wrap(IrAnalyze *ira, IrInstruction *so | ... | @@ -11623,7 +11625,7 @@ static IrInstruction *ir_analyze_optional_wrap(IrAnalyze *ira, IrInstruction *so |
| 11623 | } | 11625 | } |
| 11624 | IrInstruction *result_loc_inst = nullptr; | 11626 | IrInstruction *result_loc_inst = nullptr; |
| 11625 | if (result_loc != nullptr) { | 11627 | if (result_loc != nullptr) { |
| 11626 | result_loc_inst = ir_resolve_result(ira, source_instr, result_loc, wanted_type, nullptr, true, false); | 11628 | result_loc_inst = ir_resolve_result(ira, source_instr, result_loc, wanted_type, nullptr, true, false, true); |
| 11627 | if (type_is_invalid(result_loc_inst->value.type) || instr_is_unreachable(result_loc_inst)) { | 11629 | if (type_is_invalid(result_loc_inst->value.type) || instr_is_unreachable(result_loc_inst)) { |
| 11628 | return result_loc_inst; | 11630 | return result_loc_inst; |
| 11629 | } | 11631 | } |
| ... | @@ -11666,7 +11668,7 @@ static IrInstruction *ir_analyze_err_wrap_payload(IrAnalyze *ira, IrInstruction | ... | @@ -11666,7 +11668,7 @@ static IrInstruction *ir_analyze_err_wrap_payload(IrAnalyze *ira, IrInstruction |
| 11666 | IrInstruction *result_loc_inst; | 11668 | IrInstruction *result_loc_inst; |
| 11667 | if (handle_is_ptr(wanted_type)) { | 11669 | if (handle_is_ptr(wanted_type)) { |
| 11668 | if (result_loc == nullptr) result_loc = no_result_loc(); | 11670 | if (result_loc == nullptr) result_loc = no_result_loc(); |
| 11669 | result_loc_inst = ir_resolve_result(ira, source_instr, result_loc, wanted_type, nullptr, true, false); | 11671 | result_loc_inst = ir_resolve_result(ira, source_instr, result_loc, wanted_type, nullptr, true, false, true); |
| 11670 | if (type_is_invalid(result_loc_inst->value.type) || instr_is_unreachable(result_loc_inst)) { | 11672 | if (type_is_invalid(result_loc_inst->value.type) || instr_is_unreachable(result_loc_inst)) { |
| 11671 | return result_loc_inst; | 11673 | return result_loc_inst; |
| 11672 | } | 11674 | } |
| ... | @@ -11751,7 +11753,7 @@ static IrInstruction *ir_analyze_err_wrap_code(IrAnalyze *ira, IrInstruction *so | ... | @@ -11751,7 +11753,7 @@ static IrInstruction *ir_analyze_err_wrap_code(IrAnalyze *ira, IrInstruction *so |
| 11751 | IrInstruction *result_loc_inst; | 11753 | IrInstruction *result_loc_inst; |
| 11752 | if (handle_is_ptr(wanted_type)) { | 11754 | if (handle_is_ptr(wanted_type)) { |
| 11753 | if (result_loc == nullptr) result_loc = no_result_loc(); | 11755 | if (result_loc == nullptr) result_loc = no_result_loc(); |
| 11754 | result_loc_inst = ir_resolve_result(ira, source_instr, result_loc, wanted_type, nullptr, true, false); | 11756 | result_loc_inst = ir_resolve_result(ira, source_instr, result_loc, wanted_type, nullptr, true, false, true); |
| 11755 | if (type_is_invalid(result_loc_inst->value.type) || instr_is_unreachable(result_loc_inst)) { | 11757 | if (type_is_invalid(result_loc_inst->value.type) || instr_is_unreachable(result_loc_inst)) { |
| 11756 | return result_loc_inst; | 11758 | return result_loc_inst; |
| 11757 | } | 11759 | } |
| ... | @@ -11824,7 +11826,8 @@ static IrInstruction *ir_get_ref(IrAnalyze *ira, IrInstruction *source_instructi | ... | @@ -11824,7 +11826,8 @@ static IrInstruction *ir_get_ref(IrAnalyze *ira, IrInstruction *source_instructi |
| 11824 | | 11826 | |
| 11825 | IrInstruction *result_loc; | 11827 | IrInstruction *result_loc; |
| 11826 | if (type_has_bits(ptr_type) && !handle_is_ptr(value->value.type)) { | 11828 | if (type_has_bits(ptr_type) && !handle_is_ptr(value->value.type)) { |
| 11827 | result_loc = ir_resolve_result(ira, source_instruction, no_result_loc(), value->value.type, nullptr, true, false); | 11829 | result_loc = ir_resolve_result(ira, source_instruction, no_result_loc(), value->value.type, nullptr, true, |
| | 11830 | false, true); |
| 11828 | } else { | 11831 | } else { |
| 11829 | result_loc = nullptr; | 11832 | result_loc = nullptr; |
| 11830 | } | 11833 | } |
| ... | @@ -11868,7 +11871,8 @@ static IrInstruction *ir_analyze_array_to_slice(IrAnalyze *ira, IrInstruction *s | ... | @@ -11868,7 +11871,8 @@ static IrInstruction *ir_analyze_array_to_slice(IrAnalyze *ira, IrInstruction *s |
| 11868 | if (!array_ptr) array_ptr = ir_get_ref(ira, source_instr, array, true, false); | 11871 | if (!array_ptr) array_ptr = ir_get_ref(ira, source_instr, array, true, false); |
| 11869 | | 11872 | |
| 11870 | if (result_loc == nullptr) result_loc = no_result_loc(); | 11873 | if (result_loc == nullptr) result_loc = no_result_loc(); |
| 11871 | IrInstruction *result_loc_inst = ir_resolve_result(ira, source_instr, result_loc, wanted_type, nullptr, true, false); | 11874 | IrInstruction *result_loc_inst = ir_resolve_result(ira, source_instr, result_loc, wanted_type, nullptr, |
| | 11875 | true, false, true); |
| 11872 | if (type_is_invalid(result_loc_inst->value.type) || instr_is_unreachable(result_loc_inst)) { | 11876 | if (type_is_invalid(result_loc_inst->value.type) || instr_is_unreachable(result_loc_inst)) { |
| 11873 | return result_loc_inst; | 11877 | return result_loc_inst; |
| 11874 | } | 11878 | } |
| ... | @@ -12524,7 +12528,8 @@ static IrInstruction *ir_analyze_vector_to_array(IrAnalyze *ira, IrInstruction * | ... | @@ -12524,7 +12528,8 @@ static IrInstruction *ir_analyze_vector_to_array(IrAnalyze *ira, IrInstruction * |
| 12524 | if (result_loc == nullptr) { | 12528 | if (result_loc == nullptr) { |
| 12525 | result_loc = no_result_loc(); | 12529 | result_loc = no_result_loc(); |
| 12526 | } | 12530 | } |
| 12527 | IrInstruction *result_loc_inst = ir_resolve_result(ira, source_instr, result_loc, array_type, nullptr, true, false); | 12531 | IrInstruction *result_loc_inst = ir_resolve_result(ira, source_instr, result_loc, array_type, nullptr, |
| | 12532 | true, false, true); |
| 12528 | if (type_is_invalid(result_loc_inst->value.type) || instr_is_unreachable(result_loc_inst)) { | 12533 | if (type_is_invalid(result_loc_inst->value.type) || instr_is_unreachable(result_loc_inst)) { |
| 12529 | return result_loc_inst; | 12534 | return result_loc_inst; |
| 12530 | } | 12535 | } |
| ... | @@ -13105,7 +13110,8 @@ static IrInstruction *ir_get_deref(IrAnalyze *ira, IrInstruction *source_instruc | ... | @@ -13105,7 +13110,8 @@ static IrInstruction *ir_get_deref(IrAnalyze *ira, IrInstruction *source_instruc |
| 13105 | IrInstruction *result_loc_inst; | 13110 | IrInstruction *result_loc_inst; |
| 13106 | if (type_entry->data.pointer.host_int_bytes != 0 && handle_is_ptr(child_type)) { | 13111 | if (type_entry->data.pointer.host_int_bytes != 0 && handle_is_ptr(child_type)) { |
| 13107 | if (result_loc == nullptr) result_loc = no_result_loc(); | 13112 | if (result_loc == nullptr) result_loc = no_result_loc(); |
| 13108 | result_loc_inst = ir_resolve_result(ira, source_instruction, result_loc, child_type, nullptr, true, false); | 13113 | result_loc_inst = ir_resolve_result(ira, source_instruction, result_loc, child_type, nullptr, |
| | 13114 | true, false, true); |
| 13109 | if (type_is_invalid(result_loc_inst->value.type) || instr_is_unreachable(result_loc_inst)) { | 13115 | if (type_is_invalid(result_loc_inst->value.type) || instr_is_unreachable(result_loc_inst)) { |
| 13110 | return result_loc_inst; | 13116 | return result_loc_inst; |
| 13111 | } | 13117 | } |
| ... | @@ -15360,7 +15366,7 @@ static IrInstruction *ir_resolve_result_raw(IrAnalyze *ira, IrInstruction *suspe | ... | @@ -15360,7 +15366,7 @@ static IrInstruction *ir_resolve_result_raw(IrAnalyze *ira, IrInstruction *suspe |
| 15360 | | 15366 | |
| 15361 | if (peer_parent->peers.length == 1) { | 15367 | if (peer_parent->peers.length == 1) { |
| 15362 | IrInstruction *parent_result_loc = ir_resolve_result(ira, suspend_source_instr, peer_parent->parent, | 15368 | IrInstruction *parent_result_loc = ir_resolve_result(ira, suspend_source_instr, peer_parent->parent, |
| 15363 | value_type, value, force_runtime, non_null_comptime); | 15369 | value_type, value, force_runtime, non_null_comptime, true); |
| 15364 | result_peer->suspend_pos.basic_block_index = SIZE_MAX; | 15370 | result_peer->suspend_pos.basic_block_index = SIZE_MAX; |
| 15365 | result_peer->suspend_pos.instruction_index = SIZE_MAX; | 15371 | result_peer->suspend_pos.instruction_index = SIZE_MAX; |
| 15366 | if (parent_result_loc == nullptr || type_is_invalid(parent_result_loc->value.type) || | 15372 | if (parent_result_loc == nullptr || type_is_invalid(parent_result_loc->value.type) || |
| ... | @@ -15380,7 +15386,7 @@ static IrInstruction *ir_resolve_result_raw(IrAnalyze *ira, IrInstruction *suspe | ... | @@ -15380,7 +15386,7 @@ static IrInstruction *ir_resolve_result_raw(IrAnalyze *ira, IrInstruction *suspe |
| 15380 | if (peer_parent->skipped) { | 15386 | if (peer_parent->skipped) { |
| 15381 | if (non_null_comptime) { | 15387 | if (non_null_comptime) { |
| 15382 | return ir_resolve_result(ira, suspend_source_instr, peer_parent->parent, | 15388 | return ir_resolve_result(ira, suspend_source_instr, peer_parent->parent, |
| 15383 | value_type, value, force_runtime, non_null_comptime); | 15389 | value_type, value, force_runtime, non_null_comptime, true); |
| 15384 | } | 15390 | } |
| 15385 | return nullptr; | 15391 | return nullptr; |
| 15386 | } | 15392 | } |
| ... | @@ -15398,7 +15404,7 @@ static IrInstruction *ir_resolve_result_raw(IrAnalyze *ira, IrInstruction *suspe | ... | @@ -15398,7 +15404,7 @@ static IrInstruction *ir_resolve_result_raw(IrAnalyze *ira, IrInstruction *suspe |
| 15398 | } | 15404 | } |
| 15399 | | 15405 | |
| 15400 | IrInstruction *parent_result_loc = ir_resolve_result(ira, suspend_source_instr, peer_parent->parent, | 15406 | IrInstruction *parent_result_loc = ir_resolve_result(ira, suspend_source_instr, peer_parent->parent, |
| 15401 | peer_parent->resolved_type, nullptr, force_runtime, non_null_comptime); | 15407 | peer_parent->resolved_type, nullptr, force_runtime, non_null_comptime, true); |
| 15402 | if (parent_result_loc == nullptr || type_is_invalid(parent_result_loc->value.type) || | 15408 | if (parent_result_loc == nullptr || type_is_invalid(parent_result_loc->value.type) || |
| 15403 | parent_result_loc->value.type->id == ZigTypeIdUnreachable) | 15409 | parent_result_loc->value.type->id == ZigTypeIdUnreachable) |
| 15404 | { | 15410 | { |
| ... | @@ -15448,7 +15454,7 @@ static IrInstruction *ir_resolve_result_raw(IrAnalyze *ira, IrInstruction *suspe | ... | @@ -15448,7 +15454,7 @@ static IrInstruction *ir_resolve_result_raw(IrAnalyze *ira, IrInstruction *suspe |
| 15448 | } | 15454 | } |
| 15449 | | 15455 | |
| 15450 | IrInstruction *parent_result_loc = ir_resolve_result(ira, suspend_source_instr, result_bit_cast->parent, | 15456 | IrInstruction *parent_result_loc = ir_resolve_result(ira, suspend_source_instr, result_bit_cast->parent, |
| 15451 | dest_type, bitcasted_value, force_runtime, non_null_comptime); | 15457 | dest_type, bitcasted_value, force_runtime, non_null_comptime, true); |
| 15452 | if (parent_result_loc == nullptr || type_is_invalid(parent_result_loc->value.type) || | 15458 | if (parent_result_loc == nullptr || type_is_invalid(parent_result_loc->value.type) || |
| 15453 | parent_result_loc->value.type->id == ZigTypeIdUnreachable) | 15459 | parent_result_loc->value.type->id == ZigTypeIdUnreachable) |
| 15454 | { | 15460 | { |
| ... | @@ -15477,8 +15483,15 @@ static IrInstruction *ir_resolve_result_raw(IrAnalyze *ira, IrInstruction *suspe | ... | @@ -15477,8 +15483,15 @@ static IrInstruction *ir_resolve_result_raw(IrAnalyze *ira, IrInstruction *suspe |
| 15477 | | 15483 | |
| 15478 | static IrInstruction *ir_resolve_result(IrAnalyze *ira, IrInstruction *suspend_source_instr, | 15484 | static IrInstruction *ir_resolve_result(IrAnalyze *ira, IrInstruction *suspend_source_instr, |
| 15479 | ResultLoc *result_loc_pass1, ZigType *value_type, IrInstruction *value, bool force_runtime, | 15485 | ResultLoc *result_loc_pass1, ZigType *value_type, IrInstruction *value, bool force_runtime, |
| 15480 | bool non_null_comptime) | 15486 | bool non_null_comptime, bool allow_discard) |
| 15481 | { | 15487 | { |
| | 15488 | if (!allow_discard && result_loc_pass1->id == ResultLocIdInstruction && |
| | 15489 | instr_is_comptime(result_loc_pass1->source_instruction) && |
| | 15490 | result_loc_pass1->source_instruction->value.type->id == ZigTypeIdPointer && |
| | 15491 | result_loc_pass1->source_instruction->value.data.x_ptr.special == ConstPtrSpecialDiscard) |
| | 15492 | { |
| | 15493 | result_loc_pass1 = no_result_loc(); |
| | 15494 | } |
| 15482 | IrInstruction *result_loc = ir_resolve_result_raw(ira, suspend_source_instr, result_loc_pass1, value_type, | 15495 | IrInstruction *result_loc = ir_resolve_result_raw(ira, suspend_source_instr, result_loc_pass1, value_type, |
| 15483 | value, force_runtime, non_null_comptime); | 15496 | value, force_runtime, non_null_comptime); |
| 15484 | if (result_loc == nullptr || (instr_is_unreachable(result_loc) || type_is_invalid(result_loc->value.type))) | 15497 | if (result_loc == nullptr || (instr_is_unreachable(result_loc) || type_is_invalid(result_loc->value.type))) |
| ... | @@ -15533,7 +15546,7 @@ static IrInstruction *ir_analyze_instruction_resolve_result(IrAnalyze *ira, IrIn | ... | @@ -15533,7 +15546,7 @@ static IrInstruction *ir_analyze_instruction_resolve_result(IrAnalyze *ira, IrIn |
| 15533 | if (type_is_invalid(implicit_elem_type)) | 15546 | if (type_is_invalid(implicit_elem_type)) |
| 15534 | return ira->codegen->invalid_instruction; | 15547 | return ira->codegen->invalid_instruction; |
| 15535 | IrInstruction *result_loc = ir_resolve_result(ira, &instruction->base, instruction->result_loc, | 15548 | IrInstruction *result_loc = ir_resolve_result(ira, &instruction->base, instruction->result_loc, |
| 15536 | implicit_elem_type, nullptr, false, true); | 15549 | implicit_elem_type, nullptr, false, true, true); |
| 15537 | if (result_loc != nullptr) | 15550 | if (result_loc != nullptr) |
| 15538 | return result_loc; | 15551 | return result_loc; |
| 15539 | | 15552 | |
| ... | @@ -15542,7 +15555,7 @@ static IrInstruction *ir_analyze_instruction_resolve_result(IrAnalyze *ira, IrIn | ... | @@ -15542,7 +15555,7 @@ static IrInstruction *ir_analyze_instruction_resolve_result(IrAnalyze *ira, IrIn |
| 15542 | instruction->result_loc->id == ResultLocIdReturn) | 15555 | instruction->result_loc->id == ResultLocIdReturn) |
| 15543 | { | 15556 | { |
| 15544 | result_loc = ir_resolve_result(ira, &instruction->base, no_result_loc(), | 15557 | result_loc = ir_resolve_result(ira, &instruction->base, no_result_loc(), |
| 15545 | implicit_elem_type, nullptr, false, true); | 15558 | implicit_elem_type, nullptr, false, true, true); |
| 15546 | if (result_loc != nullptr && | 15559 | if (result_loc != nullptr && |
| 15547 | (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc))) | 15560 | (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc))) |
| 15548 | { | 15561 | { |
| ... | @@ -15631,7 +15644,7 @@ static IrInstruction *ir_analyze_async_call(IrAnalyze *ira, IrInstructionCallSrc | ... | @@ -15631,7 +15644,7 @@ static IrInstruction *ir_analyze_async_call(IrAnalyze *ira, IrInstructionCallSrc |
| 15631 | ZigType *async_return_type = get_error_union_type(ira->codegen, alloc_fn_error_set_type, promise_type); | 15644 | ZigType *async_return_type = get_error_union_type(ira->codegen, alloc_fn_error_set_type, promise_type); |
| 15632 | | 15645 | |
| 15633 | IrInstruction *result_loc = ir_resolve_result(ira, &call_instruction->base, no_result_loc(), | 15646 | IrInstruction *result_loc = ir_resolve_result(ira, &call_instruction->base, no_result_loc(), |
| 15634 | async_return_type, nullptr, true, true); | 15647 | async_return_type, nullptr, true, true, false); |
| 15635 | if (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)) { | 15648 | if (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)) { |
| 15636 | return result_loc; | 15649 | return result_loc; |
| 15637 | } | 15650 | } |
| ... | @@ -16390,7 +16403,7 @@ static IrInstruction *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCallSrc *c | ... | @@ -16390,7 +16403,7 @@ static IrInstruction *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCallSrc *c |
| 16390 | IrInstruction *result_loc; | 16403 | IrInstruction *result_loc; |
| 16391 | if (handle_is_ptr(impl_fn_type_id->return_type)) { | 16404 | if (handle_is_ptr(impl_fn_type_id->return_type)) { |
| 16392 | result_loc = ir_resolve_result(ira, &call_instruction->base, call_instruction->result_loc, | 16405 | result_loc = ir_resolve_result(ira, &call_instruction->base, call_instruction->result_loc, |
| 16393 | impl_fn_type_id->return_type, nullptr, true, true); | 16406 | impl_fn_type_id->return_type, nullptr, true, true, false); |
| 16394 | if (result_loc != nullptr && (type_is_invalid(result_loc->value.type) || | 16407 | if (result_loc != nullptr && (type_is_invalid(result_loc->value.type) || |
| 16395 | instr_is_unreachable(result_loc))) | 16408 | instr_is_unreachable(result_loc))) |
| 16396 | { | 16409 | { |
| ... | @@ -16512,7 +16525,7 @@ static IrInstruction *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCallSrc *c | ... | @@ -16512,7 +16525,7 @@ static IrInstruction *ir_analyze_fn_call(IrAnalyze *ira, IrInstructionCallSrc *c |
| 16512 | IrInstruction *result_loc; | 16525 | IrInstruction *result_loc; |
| 16513 | if (handle_is_ptr(return_type)) { | 16526 | if (handle_is_ptr(return_type)) { |
| 16514 | result_loc = ir_resolve_result(ira, &call_instruction->base, call_instruction->result_loc, | 16527 | result_loc = ir_resolve_result(ira, &call_instruction->base, call_instruction->result_loc, |
| 16515 | return_type, nullptr, true, true); | 16528 | return_type, nullptr, true, true, false); |
| 16516 | if (result_loc != nullptr && (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc))) { | 16529 | if (result_loc != nullptr && (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc))) { |
| 16517 | return result_loc; | 16530 | return result_loc; |
| 16518 | } | 16531 | } |
| ... | @@ -17028,7 +17041,7 @@ static IrInstruction *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionPh | ... | @@ -17028,7 +17041,7 @@ static IrInstruction *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionPh |
| 17028 | | 17041 | |
| 17029 | // In case resolving the parent activates a suspend, do it now | 17042 | // In case resolving the parent activates a suspend, do it now |
| 17030 | IrInstruction *parent_result_loc = ir_resolve_result(ira, &phi_instruction->base, peer_parent->parent, | 17043 | IrInstruction *parent_result_loc = ir_resolve_result(ira, &phi_instruction->base, peer_parent->parent, |
| 17031 | peer_parent->resolved_type, nullptr, false, false); | 17044 | peer_parent->resolved_type, nullptr, false, false, true); |
| 17032 | if (parent_result_loc != nullptr && | 17045 | if (parent_result_loc != nullptr && |
| 17033 | (type_is_invalid(parent_result_loc->value.type) || instr_is_unreachable(parent_result_loc))) | 17046 | (type_is_invalid(parent_result_loc->value.type) || instr_is_unreachable(parent_result_loc))) |
| 17034 | { | 17047 | { |
| ... | @@ -21541,7 +21554,7 @@ static IrInstruction *ir_analyze_instruction_cmpxchg(IrAnalyze *ira, IrInstructi | ... | @@ -21541,7 +21554,7 @@ static IrInstruction *ir_analyze_instruction_cmpxchg(IrAnalyze *ira, IrInstructi |
| 21541 | IrInstruction *result_loc; | 21554 | IrInstruction *result_loc; |
| 21542 | if (handle_is_ptr(result_type)) { | 21555 | if (handle_is_ptr(result_type)) { |
| 21543 | result_loc = ir_resolve_result(ira, &instruction->base, instruction->result_loc, | 21556 | result_loc = ir_resolve_result(ira, &instruction->base, instruction->result_loc, |
| 21544 | result_type, nullptr, true, false); | 21557 | result_type, nullptr, true, false, true); |
| 21545 | if (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)) { | 21558 | if (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)) { |
| 21546 | return result_loc; | 21559 | return result_loc; |
| 21547 | } | 21560 | } |
| ... | @@ -21798,7 +21811,7 @@ static IrInstruction *ir_analyze_instruction_from_bytes(IrAnalyze *ira, IrInstru | ... | @@ -21798,7 +21811,7 @@ static IrInstruction *ir_analyze_instruction_from_bytes(IrAnalyze *ira, IrInstru |
| 21798 | } | 21811 | } |
| 21799 | | 21812 | |
| 21800 | IrInstruction *result_loc = ir_resolve_result(ira, &instruction->base, instruction->result_loc, | 21813 | IrInstruction *result_loc = ir_resolve_result(ira, &instruction->base, instruction->result_loc, |
| 21801 | dest_slice_type, nullptr, true, false); | 21814 | dest_slice_type, nullptr, true, false, true); |
| 21802 | if (result_loc != nullptr && (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc))) { | 21815 | if (result_loc != nullptr && (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc))) { |
| 21803 | return result_loc; | 21816 | return result_loc; |
| 21804 | } | 21817 | } |
| ... | @@ -21875,7 +21888,7 @@ static IrInstruction *ir_analyze_instruction_to_bytes(IrAnalyze *ira, IrInstruct | ... | @@ -21875,7 +21888,7 @@ static IrInstruction *ir_analyze_instruction_to_bytes(IrAnalyze *ira, IrInstruct |
| 21875 | } | 21888 | } |
| 21876 | | 21889 | |
| 21877 | IrInstruction *result_loc = ir_resolve_result(ira, &instruction->base, instruction->result_loc, | 21890 | IrInstruction *result_loc = ir_resolve_result(ira, &instruction->base, instruction->result_loc, |
| 21878 | dest_slice_type, nullptr, true, false); | 21891 | dest_slice_type, nullptr, true, false, true); |
| 21879 | if (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)) { | 21892 | if (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)) { |
| 21880 | return result_loc; | 21893 | return result_loc; |
| 21881 | } | 21894 | } |
| ... | @@ -22617,7 +22630,7 @@ static IrInstruction *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstruction | ... | @@ -22617,7 +22630,7 @@ static IrInstruction *ir_analyze_instruction_slice(IrAnalyze *ira, IrInstruction |
| 22617 | } | 22630 | } |
| 22618 | | 22631 | |
| 22619 | IrInstruction *result_loc = ir_resolve_result(ira, &instruction->base, instruction->result_loc, | 22632 | IrInstruction *result_loc = ir_resolve_result(ira, &instruction->base, instruction->result_loc, |
| 22620 | return_type, nullptr, true, false); | 22633 | return_type, nullptr, true, false, true); |
| 22621 | if (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)) { | 22634 | if (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)) { |
| 22622 | return result_loc; | 22635 | return result_loc; |
| 22623 | } | 22636 | } |
| ... | @@ -25397,7 +25410,7 @@ static IrInstruction *ir_analyze_instruction_end_expr(IrAnalyze *ira, IrInstruct | ... | @@ -25397,7 +25410,7 @@ static IrInstruction *ir_analyze_instruction_end_expr(IrAnalyze *ira, IrInstruct |
| 25397 | | 25410 | |
| 25398 | bool was_written = instruction->result_loc->written; | 25411 | bool was_written = instruction->result_loc->written; |
| 25399 | IrInstruction *result_loc = ir_resolve_result(ira, &instruction->base, instruction->result_loc, | 25412 | IrInstruction *result_loc = ir_resolve_result(ira, &instruction->base, instruction->result_loc, |
| 25400 | value->value.type, value, false, false); | 25413 | value->value.type, value, false, false, true); |
| 25401 | if (result_loc != nullptr) { | 25414 | if (result_loc != nullptr) { |
| 25402 | if (type_is_invalid(result_loc->value.type)) | 25415 | if (type_is_invalid(result_loc->value.type)) |
| 25403 | return ira->codegen->invalid_instruction; | 25416 | return ira->codegen->invalid_instruction; |
| ... | @@ -25429,7 +25442,7 @@ static IrInstruction *ir_analyze_instruction_bit_cast_src(IrAnalyze *ira, IrInst | ... | @@ -25429,7 +25442,7 @@ static IrInstruction *ir_analyze_instruction_bit_cast_src(IrAnalyze *ira, IrInst |
| 25429 | return operand; | 25442 | return operand; |
| 25430 | | 25443 | |
| 25431 | IrInstruction *result_loc = ir_resolve_result(ira, &instruction->base, | 25444 | IrInstruction *result_loc = ir_resolve_result(ira, &instruction->base, |
| 25432 | &instruction->result_loc_bit_cast->base, operand->value.type, operand, false, false); | 25445 | &instruction->result_loc_bit_cast->base, operand->value.type, operand, false, false, true); |
| 25433 | if (result_loc != nullptr && (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc))) | 25446 | if (result_loc != nullptr && (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc))) |
| 25434 | return result_loc; | 25447 | return result_loc; |
| 25435 | | 25448 | |