| ... | @@ -3131,16 +3131,16 @@ static IrInstruction *ir_build_check_runtime_scope(IrBuilder *irb, Scope *scope, | ... | @@ -3131,16 +3131,16 @@ static IrInstruction *ir_build_check_runtime_scope(IrBuilder *irb, Scope *scope, |
| 3131 | } | 3131 | } |
| 3132 | | 3132 | |
| 3133 | static IrInstruction *ir_build_vector_to_array(IrAnalyze *ira, IrInstruction *source_instruction, | 3133 | static IrInstruction *ir_build_vector_to_array(IrAnalyze *ira, IrInstruction *source_instruction, |
| 3134 | IrInstruction *vector, ZigType *result_type) | 3134 | ZigType *result_type, IrInstruction *vector, IrInstruction *result_loc) |
| 3135 | { | 3135 | { |
| 3136 | IrInstructionVectorToArray *instruction = ir_build_instruction<IrInstructionVectorToArray>(&ira->new_irb, | 3136 | IrInstructionVectorToArray *instruction = ir_build_instruction<IrInstructionVectorToArray>(&ira->new_irb, |
| 3137 | source_instruction->scope, source_instruction->source_node); | 3137 | source_instruction->scope, source_instruction->source_node); |
| 3138 | instruction->base.value.type = result_type; | 3138 | instruction->base.value.type = result_type; |
| 3139 | instruction->vector = vector; | 3139 | instruction->vector = vector; |
| | 3140 | instruction->result_loc = result_loc; |
| 3140 | | 3141 | |
| 3141 | ir_ref_instruction(vector, ira->new_irb.current_basic_block); | 3142 | ir_ref_instruction(vector, ira->new_irb.current_basic_block); |
| 3142 | | 3143 | ir_ref_instruction(result_loc, ira->new_irb.current_basic_block); |
| 3143 | ir_add_alloca(ira, &instruction->base, result_type); | | |
| 3144 | | 3144 | |
| 3145 | return &instruction->base; | 3145 | return &instruction->base; |
| 3146 | } | 3146 | } |
| ... | @@ -11985,7 +11985,7 @@ static IrInstruction *ir_analyze_array_to_vector(IrAnalyze *ira, IrInstruction * | ... | @@ -11985,7 +11985,7 @@ static IrInstruction *ir_analyze_array_to_vector(IrAnalyze *ira, IrInstruction * |
| 11985 | } | 11985 | } |
| 11986 | | 11986 | |
| 11987 | static IrInstruction *ir_analyze_vector_to_array(IrAnalyze *ira, IrInstruction *source_instr, | 11987 | static IrInstruction *ir_analyze_vector_to_array(IrAnalyze *ira, IrInstruction *source_instr, |
| 11988 | IrInstruction *vector, ZigType *array_type) | 11988 | IrInstruction *vector, ZigType *array_type, ResultLoc *result_loc) |
| 11989 | { | 11989 | { |
| 11990 | if (instr_is_comptime(vector)) { | 11990 | if (instr_is_comptime(vector)) { |
| 11991 | // arrays and vectors have the same ConstExprValue representation | 11991 | // arrays and vectors have the same ConstExprValue representation |
| ... | @@ -11994,7 +11994,11 @@ static IrInstruction *ir_analyze_vector_to_array(IrAnalyze *ira, IrInstruction * | ... | @@ -11994,7 +11994,11 @@ static IrInstruction *ir_analyze_vector_to_array(IrAnalyze *ira, IrInstruction * |
| 11994 | result->value.type = array_type; | 11994 | result->value.type = array_type; |
| 11995 | return result; | 11995 | return result; |
| 11996 | } | 11996 | } |
| 11997 | return ir_build_vector_to_array(ira, source_instr, vector, array_type); | 11997 | IrInstruction *result_loc_inst = ir_resolve_result(ira, source_instr, result_loc, array_type, nullptr); |
| | 11998 | if (type_is_invalid(result_loc_inst->value.type) || instr_is_unreachable(result_loc_inst)) { |
| | 11999 | return result_loc_inst; |
| | 12000 | } |
| | 12001 | return ir_build_vector_to_array(ira, source_instr, array_type, vector, result_loc_inst); |
| 11998 | } | 12002 | } |
| 11999 | | 12003 | |
| 12000 | static IrInstruction *ir_analyze_int_to_c_ptr(IrAnalyze *ira, IrInstruction *source_instr, | 12004 | static IrInstruction *ir_analyze_int_to_c_ptr(IrAnalyze *ira, IrInstruction *source_instr, |
| ... | @@ -12453,7 +12457,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst | ... | @@ -12453,7 +12457,7 @@ static IrInstruction *ir_analyze_cast(IrAnalyze *ira, IrInstruction *source_inst |
| 12453 | types_match_const_cast_only(ira, wanted_type->data.array.child_type, | 12457 | types_match_const_cast_only(ira, wanted_type->data.array.child_type, |
| 12454 | actual_type->data.vector.elem_type, source_node, false).id == ConstCastResultIdOk) | 12458 | actual_type->data.vector.elem_type, source_node, false).id == ConstCastResultIdOk) |
| 12455 | { | 12459 | { |
| 12456 | return ir_analyze_vector_to_array(ira, source_instr, value, wanted_type); | 12460 | return ir_analyze_vector_to_array(ira, source_instr, value, wanted_type, result_loc); |
| 12457 | } | 12461 | } |
| 12458 | | 12462 | |
| 12459 | // cast from [N]T to @Vector(N, T) | 12463 | // cast from [N]T to @Vector(N, T) |
| ... | @@ -24484,6 +24488,7 @@ bool ir_has_side_effects(IrInstruction *instruction) { | ... | @@ -24484,6 +24488,7 @@ bool ir_has_side_effects(IrInstruction *instruction) { |
| 24484 | case IrInstructionIdPtrOfArrayToSlice: | 24488 | case IrInstructionIdPtrOfArrayToSlice: |
| 24485 | case IrInstructionIdSliceGen: | 24489 | case IrInstructionIdSliceGen: |
| 24486 | case IrInstructionIdOptionalWrap: | 24490 | case IrInstructionIdOptionalWrap: |
| | 24491 | case IrInstructionIdVectorToArray: |
| 24487 | return true; | 24492 | return true; |
| 24488 | | 24493 | |
| 24489 | case IrInstructionIdPhi: | 24494 | case IrInstructionIdPhi: |
| ... | @@ -24578,7 +24583,6 @@ bool ir_has_side_effects(IrInstruction *instruction) { | ... | @@ -24578,7 +24583,6 @@ bool ir_has_side_effects(IrInstruction *instruction) { |
| 24578 | case IrInstructionIdFromBytes: | 24583 | case IrInstructionIdFromBytes: |
| 24579 | case IrInstructionIdToBytes: | 24584 | case IrInstructionIdToBytes: |
| 24580 | case IrInstructionIdEnumToInt: | 24585 | case IrInstructionIdEnumToInt: |
| 24581 | case IrInstructionIdVectorToArray: | | |
| 24582 | case IrInstructionIdArrayToVector: | 24586 | case IrInstructionIdArrayToVector: |
| 24583 | case IrInstructionIdHasDecl: | 24587 | case IrInstructionIdHasDecl: |
| 24584 | case IrInstructionIdAllocaSrc: | 24588 | case IrInstructionIdAllocaSrc: |