| ... | @@ -10908,10 +10908,15 @@ static TypeTableEntry *ir_analyze_bin_op_bool(IrAnalyze *ira, IrInstructionBinOp | ... | @@ -10908,10 +10908,15 @@ static TypeTableEntry *ir_analyze_bin_op_bool(IrAnalyze *ira, IrInstructionBinOp |
| 10908 | if (casted_op2 == ira->codegen->invalid_instruction) | 10908 | if (casted_op2 == ira->codegen->invalid_instruction) |
| 10909 | return ira->codegen->builtin_types.entry_invalid; | 10909 | return ira->codegen->builtin_types.entry_invalid; |
| 10910 | | 10910 | |
| 10911 | ConstExprValue *op1_val = &casted_op1->value; | 10911 | if (instr_is_comptime(casted_op1) && instr_is_comptime(casted_op2)) { |
| 10912 | ConstExprValue *op2_val = &casted_op2->value; | | |
| 10913 | if (op1_val->special != ConstValSpecialRuntime && op2_val->special != ConstValSpecialRuntime) { | | |
| 10914 | ConstExprValue *out_val = ir_build_const_from(ira, &bin_op_instruction->base); | 10912 | ConstExprValue *out_val = ir_build_const_from(ira, &bin_op_instruction->base); |
| | 10913 | ConstExprValue *op1_val = ir_resolve_const(ira, casted_op1, UndefBad); |
| | 10914 | if (op1_val == nullptr) |
| | 10915 | return ira->codegen->builtin_types.entry_invalid; |
| | 10916 | |
| | 10917 | ConstExprValue *op2_val = ir_resolve_const(ira, casted_op2, UndefBad); |
| | 10918 | if (op2_val == nullptr) |
| | 10919 | return ira->codegen->builtin_types.entry_invalid; |
| 10915 | | 10920 | |
| 10916 | assert(casted_op1->value.type->id == TypeTableEntryIdBool); | 10921 | assert(casted_op1->value.type->id == TypeTableEntryIdBool); |
| 10917 | assert(casted_op2->value.type->id == TypeTableEntryIdBool); | 10922 | assert(casted_op2->value.type->id == TypeTableEntryIdBool); |
| ... | @@ -11061,9 +11066,14 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp | ... | @@ -11061,9 +11066,14 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp |
| 11061 | } | 11066 | } |
| 11062 | } | 11067 | } |
| 11063 | | 11068 | |
| 11064 | ConstExprValue *op1_val = &op1->value; | 11069 | if (instr_is_comptime(op1) && instr_is_comptime(op2)) { |
| 11065 | ConstExprValue *op2_val = &op2->value; | 11070 | ConstExprValue *op1_val = ir_resolve_const(ira, op1, UndefBad); |
| 11066 | if (value_is_comptime(op1_val) && value_is_comptime(op2_val)) { | 11071 | if (op1_val == nullptr) |
| | 11072 | return ira->codegen->builtin_types.entry_invalid; |
| | 11073 | ConstExprValue *op2_val = ir_resolve_const(ira, op2, UndefBad); |
| | 11074 | if (op2_val == nullptr) |
| | 11075 | return ira->codegen->builtin_types.entry_invalid; |
| | 11076 | |
| 11067 | bool answer; | 11077 | bool answer; |
| 11068 | bool are_equal = op1_val->data.x_err_set->value == op2_val->data.x_err_set->value; | 11078 | bool are_equal = op1_val->data.x_err_set->value == op2_val->data.x_err_set->value; |
| 11069 | if (op_id == IrBinOpCmpEq) { | 11079 | if (op_id == IrBinOpCmpEq) { |
| ... | @@ -11152,10 +11162,15 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp | ... | @@ -11152,10 +11162,15 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp |
| 11152 | if (casted_op2 == ira->codegen->invalid_instruction) | 11162 | if (casted_op2 == ira->codegen->invalid_instruction) |
| 11153 | return ira->codegen->builtin_types.entry_invalid; | 11163 | return ira->codegen->builtin_types.entry_invalid; |
| 11154 | | 11164 | |
| 11155 | ConstExprValue *op1_val = &casted_op1->value; | | |
| 11156 | ConstExprValue *op2_val = &casted_op2->value; | | |
| 11157 | bool one_possible_value = !type_requires_comptime(resolved_type) && !type_has_bits(resolved_type); | 11165 | bool one_possible_value = !type_requires_comptime(resolved_type) && !type_has_bits(resolved_type); |
| 11158 | if (one_possible_value || (value_is_comptime(op1_val) && value_is_comptime(op2_val))) { | 11166 | if (one_possible_value || (instr_is_comptime(casted_op1) && instr_is_comptime(casted_op2))) { |
| | 11167 | ConstExprValue *op1_val = one_possible_value ? &casted_op1->value : ir_resolve_const(ira, casted_op1, UndefBad); |
| | 11168 | if (op1_val == nullptr) |
| | 11169 | return ira->codegen->builtin_types.entry_invalid; |
| | 11170 | ConstExprValue *op2_val = one_possible_value ? &casted_op2->value : ir_resolve_const(ira, casted_op2, UndefBad); |
| | 11171 | if (op2_val == nullptr) |
| | 11172 | return ira->codegen->builtin_types.entry_invalid; |
| | 11173 | |
| 11159 | bool answer; | 11174 | bool answer; |
| 11160 | if (resolved_type->id == TypeTableEntryIdComptimeFloat || resolved_type->id == TypeTableEntryIdFloat) { | 11175 | if (resolved_type->id == TypeTableEntryIdComptimeFloat || resolved_type->id == TypeTableEntryIdFloat) { |
| 11161 | Cmp cmp_result = float_cmp(op1_val, op2_val); | 11176 | Cmp cmp_result = float_cmp(op1_val, op2_val); |
| ... | @@ -11183,11 +11198,17 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp | ... | @@ -11183,11 +11198,17 @@ static TypeTableEntry *ir_analyze_bin_op_cmp(IrAnalyze *ira, IrInstructionBinOp |
| 11183 | if (resolved_type->id == TypeTableEntryIdInt && !resolved_type->data.integral.is_signed) { | 11198 | if (resolved_type->id == TypeTableEntryIdInt && !resolved_type->data.integral.is_signed) { |
| 11184 | ConstExprValue *known_left_val; | 11199 | ConstExprValue *known_left_val; |
| 11185 | IrBinOp flipped_op_id; | 11200 | IrBinOp flipped_op_id; |
| 11186 | if (value_is_comptime(op1_val)) { | 11201 | if (instr_is_comptime(casted_op1)) { |
| 11187 | known_left_val = op1_val; | 11202 | known_left_val = ir_resolve_const(ira, casted_op1, UndefBad); |
| | 11203 | if (known_left_val == nullptr) |
| | 11204 | return ira->codegen->builtin_types.entry_invalid; |
| | 11205 | |
| 11188 | flipped_op_id = op_id; | 11206 | flipped_op_id = op_id; |
| 11189 | } else if (value_is_comptime(op2_val)) { | 11207 | } else if (instr_is_comptime(casted_op2)) { |
| 11190 | known_left_val = op2_val; | 11208 | known_left_val = ir_resolve_const(ira, casted_op2, UndefBad); |
| | 11209 | if (known_left_val == nullptr) |
| | 11210 | return ira->codegen->builtin_types.entry_invalid; |
| | 11211 | |
| 11191 | if (op_id == IrBinOpCmpLessThan) { | 11212 | if (op_id == IrBinOpCmpLessThan) { |
| 11192 | flipped_op_id = IrBinOpCmpGreaterThan; | 11213 | flipped_op_id = IrBinOpCmpGreaterThan; |
| 11193 | } else if (op_id == IrBinOpCmpGreaterThan) { | 11214 | } else if (op_id == IrBinOpCmpGreaterThan) { |
| ... | @@ -11459,8 +11480,14 @@ static TypeTableEntry *ir_analyze_bit_shift(IrAnalyze *ira, IrInstructionBinOp * | ... | @@ -11459,8 +11480,14 @@ static TypeTableEntry *ir_analyze_bit_shift(IrAnalyze *ira, IrInstructionBinOp * |
| 11459 | } | 11480 | } |
| 11460 | | 11481 | |
| 11461 | if (instr_is_comptime(op1) && instr_is_comptime(casted_op2)) { | 11482 | if (instr_is_comptime(op1) && instr_is_comptime(casted_op2)) { |
| 11462 | ConstExprValue *op1_val = &op1->value; | 11483 | ConstExprValue *op1_val = ir_resolve_const(ira, op1, UndefBad); |
| 11463 | ConstExprValue *op2_val = &casted_op2->value; | 11484 | if (op1_val == nullptr) |
| | 11485 | return ira->codegen->builtin_types.entry_invalid; |
| | 11486 | |
| | 11487 | ConstExprValue *op2_val = ir_resolve_const(ira, casted_op2, UndefBad); |
| | 11488 | if (op2_val == nullptr) |
| | 11489 | return ira->codegen->builtin_types.entry_invalid; |
| | 11490 | |
| 11464 | IrInstruction *result_instruction = ir_get_const(ira, &bin_op_instruction->base); | 11491 | IrInstruction *result_instruction = ir_get_const(ira, &bin_op_instruction->base); |
| 11465 | ir_link_new_instruction(result_instruction, &bin_op_instruction->base); | 11492 | ir_link_new_instruction(result_instruction, &bin_op_instruction->base); |
| 11466 | ConstExprValue *out_val = &result_instruction->value; | 11493 | ConstExprValue *out_val = &result_instruction->value; |
| ... | @@ -11539,7 +11566,15 @@ static TypeTableEntry *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp | ... | @@ -11539,7 +11566,15 @@ static TypeTableEntry *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp |
| 11539 | if (is_signed_div) { | 11566 | if (is_signed_div) { |
| 11540 | bool ok = false; | 11567 | bool ok = false; |
| 11541 | if (instr_is_comptime(op1) && instr_is_comptime(op2)) { | 11568 | if (instr_is_comptime(op1) && instr_is_comptime(op2)) { |
| 11542 | if (bigint_cmp_zero(&op2->value.data.x_bigint) == CmpEQ) { | 11569 | ConstExprValue *op1_val = ir_resolve_const(ira, op1, UndefBad); |
| | 11570 | if (op1_val == nullptr) |
| | 11571 | return ira->codegen->builtin_types.entry_invalid; |
| | 11572 | |
| | 11573 | ConstExprValue *op2_val = ir_resolve_const(ira, op2, UndefBad); |
| | 11574 | if (op2_val == nullptr) |
| | 11575 | return ira->codegen->builtin_types.entry_invalid; |
| | 11576 | |
| | 11577 | if (bigint_cmp_zero(&op2_val->data.x_bigint) == CmpEQ) { |
| 11543 | // the division by zero error will be caught later, but we don't have a | 11578 | // the division by zero error will be caught later, but we don't have a |
| 11544 | // division function ambiguity problem. | 11579 | // division function ambiguity problem. |
| 11545 | op_id = IrBinOpDivTrunc; | 11580 | op_id = IrBinOpDivTrunc; |
| ... | @@ -11547,8 +11582,8 @@ static TypeTableEntry *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp | ... | @@ -11547,8 +11582,8 @@ static TypeTableEntry *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp |
| 11547 | } else { | 11582 | } else { |
| 11548 | BigInt trunc_result; | 11583 | BigInt trunc_result; |
| 11549 | BigInt floor_result; | 11584 | BigInt floor_result; |
| 11550 | bigint_div_trunc(&trunc_result, &op1->value.data.x_bigint, &op2->value.data.x_bigint); | 11585 | bigint_div_trunc(&trunc_result, &op1_val->data.x_bigint, &op2_val->data.x_bigint); |
| 11551 | bigint_div_floor(&floor_result, &op1->value.data.x_bigint, &op2->value.data.x_bigint); | 11586 | bigint_div_floor(&floor_result, &op1_val->data.x_bigint, &op2_val->data.x_bigint); |
| 11552 | if (bigint_cmp(&trunc_result, &floor_result) == CmpEQ) { | 11587 | if (bigint_cmp(&trunc_result, &floor_result) == CmpEQ) { |
| 11553 | ok = true; | 11588 | ok = true; |
| 11554 | op_id = IrBinOpDivTrunc; | 11589 | op_id = IrBinOpDivTrunc; |
| ... | @@ -11569,7 +11604,15 @@ static TypeTableEntry *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp | ... | @@ -11569,7 +11604,15 @@ static TypeTableEntry *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp |
| 11569 | if (is_signed_div && (is_int || is_float)) { | 11604 | if (is_signed_div && (is_int || is_float)) { |
| 11570 | bool ok = false; | 11605 | bool ok = false; |
| 11571 | if (instr_is_comptime(op1) && instr_is_comptime(op2)) { | 11606 | if (instr_is_comptime(op1) && instr_is_comptime(op2)) { |
| | 11607 | ConstExprValue *op1_val = ir_resolve_const(ira, op1, UndefBad); |
| | 11608 | if (op1_val == nullptr) |
| | 11609 | return ira->codegen->builtin_types.entry_invalid; |
| | 11610 | |
| 11572 | if (is_int) { | 11611 | if (is_int) { |
| | 11612 | ConstExprValue *op2_val = ir_resolve_const(ira, op2, UndefBad); |
| | 11613 | if (op2_val == nullptr) |
| | 11614 | return ira->codegen->builtin_types.entry_invalid; |
| | 11615 | |
| 11573 | if (bigint_cmp_zero(&op2->value.data.x_bigint) == CmpEQ) { | 11616 | if (bigint_cmp_zero(&op2->value.data.x_bigint) == CmpEQ) { |
| 11574 | // the division by zero error will be caught later, but we don't | 11617 | // the division by zero error will be caught later, but we don't |
| 11575 | // have a remainder function ambiguity problem | 11618 | // have a remainder function ambiguity problem |
| ... | @@ -11577,14 +11620,19 @@ static TypeTableEntry *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp | ... | @@ -11577,14 +11620,19 @@ static TypeTableEntry *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp |
| 11577 | } else { | 11620 | } else { |
| 11578 | BigInt rem_result; | 11621 | BigInt rem_result; |
| 11579 | BigInt mod_result; | 11622 | BigInt mod_result; |
| 11580 | bigint_rem(&rem_result, &op1->value.data.x_bigint, &op2->value.data.x_bigint); | 11623 | bigint_rem(&rem_result, &op1_val->data.x_bigint, &op2_val->data.x_bigint); |
| 11581 | bigint_mod(&mod_result, &op1->value.data.x_bigint, &op2->value.data.x_bigint); | 11624 | bigint_mod(&mod_result, &op1_val->data.x_bigint, &op2_val->data.x_bigint); |
| 11582 | ok = bigint_cmp(&rem_result, &mod_result) == CmpEQ; | 11625 | ok = bigint_cmp(&rem_result, &mod_result) == CmpEQ; |
| 11583 | } | 11626 | } |
| 11584 | } else { | 11627 | } else { |
| 11585 | IrInstruction *casted_op2 = ir_implicit_cast(ira, op2, resolved_type); | 11628 | IrInstruction *casted_op2 = ir_implicit_cast(ira, op2, resolved_type); |
| 11586 | if (casted_op2 == ira->codegen->invalid_instruction) | 11629 | if (casted_op2 == ira->codegen->invalid_instruction) |
| 11587 | return ira->codegen->builtin_types.entry_invalid; | 11630 | return ira->codegen->builtin_types.entry_invalid; |
| | 11631 | |
| | 11632 | ConstExprValue *op2_val = ir_resolve_const(ira, casted_op2, UndefBad); |
| | 11633 | if (op2_val == nullptr) |
| | 11634 | return ira->codegen->builtin_types.entry_invalid; |
| | 11635 | |
| 11588 | if (float_cmp_zero(&casted_op2->value) == CmpEQ) { | 11636 | if (float_cmp_zero(&casted_op2->value) == CmpEQ) { |
| 11589 | // the division by zero error will be caught later, but we don't | 11637 | // the division by zero error will be caught later, but we don't |
| 11590 | // have a remainder function ambiguity problem | 11638 | // have a remainder function ambiguity problem |
| ... | @@ -11592,8 +11640,8 @@ static TypeTableEntry *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp | ... | @@ -11592,8 +11640,8 @@ static TypeTableEntry *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp |
| 11592 | } else { | 11640 | } else { |
| 11593 | ConstExprValue rem_result; | 11641 | ConstExprValue rem_result; |
| 11594 | ConstExprValue mod_result; | 11642 | ConstExprValue mod_result; |
| 11595 | float_rem(&rem_result, &op1->value, &casted_op2->value); | 11643 | float_rem(&rem_result, op1_val, op2_val); |
| 11596 | float_mod(&mod_result, &op1->value, &casted_op2->value); | 11644 | float_mod(&mod_result, op1_val, op2_val); |
| 11597 | ok = float_cmp(&rem_result, &mod_result) == CmpEQ; | 11645 | ok = float_cmp(&rem_result, &mod_result) == CmpEQ; |
| 11598 | } | 11646 | } |
| 11599 | } | 11647 | } |
| ... | @@ -11651,8 +11699,13 @@ static TypeTableEntry *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp | ... | @@ -11651,8 +11699,13 @@ static TypeTableEntry *ir_analyze_bin_op_math(IrAnalyze *ira, IrInstructionBinOp |
| 11651 | return ira->codegen->builtin_types.entry_invalid; | 11699 | return ira->codegen->builtin_types.entry_invalid; |
| 11652 | | 11700 | |
| 11653 | if (instr_is_comptime(casted_op1) && instr_is_comptime(casted_op2)) { | 11701 | if (instr_is_comptime(casted_op1) && instr_is_comptime(casted_op2)) { |
| 11654 | ConstExprValue *op1_val = &casted_op1->value; | 11702 | ConstExprValue *op1_val = ir_resolve_const(ira, casted_op1, UndefBad); |
| 11655 | ConstExprValue *op2_val = &casted_op2->value; | 11703 | if (op1_val == nullptr) |
| | 11704 | return ira->codegen->builtin_types.entry_invalid; |
| | 11705 | ConstExprValue *op2_val = ir_resolve_const(ira, casted_op2, UndefBad); |
| | 11706 | if (op2_val == nullptr) |
| | 11707 | return ira->codegen->builtin_types.entry_invalid; |
| | 11708 | |
| 11656 | IrInstruction *result_instruction = ir_get_const(ira, &bin_op_instruction->base); | 11709 | IrInstruction *result_instruction = ir_get_const(ira, &bin_op_instruction->base); |
| 11657 | ir_link_new_instruction(result_instruction, &bin_op_instruction->base); | 11710 | ir_link_new_instruction(result_instruction, &bin_op_instruction->base); |
| 11658 | ConstExprValue *out_val = &result_instruction->value; | 11711 | ConstExprValue *out_val = &result_instruction->value; |
| ... | @@ -11827,9 +11880,16 @@ static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp * | ... | @@ -11827,9 +11880,16 @@ static TypeTableEntry *ir_analyze_array_cat(IrAnalyze *ira, IrInstructionBinOp * |
| 11827 | out_val->data.x_ptr.data.base_array.array_val = out_array_val; | 11880 | out_val->data.x_ptr.data.base_array.array_val = out_array_val; |
| 11828 | out_val->data.x_ptr.data.base_array.elem_index = 0; | 11881 | out_val->data.x_ptr.data.base_array.elem_index = 0; |
| 11829 | } | 11882 | } |
| 11830 | out_array_val->data.x_array.s_none.elements = create_const_vals(new_len); | | |
| 11831 | | 11883 | |
| | 11884 | if (op1_array_val->data.x_array.special == ConstArraySpecialUndef && |
| | 11885 | op2_array_val->data.x_array.special == ConstArraySpecialUndef) { |
| | 11886 | out_array_val->data.x_array.special = ConstArraySpecialUndef; |
| | 11887 | return result_type; |
| | 11888 | } |
| | 11889 | |
| | 11890 | out_array_val->data.x_array.s_none.elements = create_const_vals(new_len); |
| 11832 | expand_undef_array(ira->codegen, op1_array_val); | 11891 | expand_undef_array(ira->codegen, op1_array_val); |
| | 11892 | expand_undef_array(ira->codegen, op2_array_val); |
| 11833 | | 11893 | |
| 11834 | size_t next_index = 0; | 11894 | size_t next_index = 0; |
| 11835 | for (size_t i = op1_array_index; i < op1_array_end; i += 1, next_index += 1) { | 11895 | for (size_t i = op1_array_index; i < op1_array_end; i += 1, next_index += 1) { |
| ... | @@ -11881,10 +11941,14 @@ static TypeTableEntry *ir_analyze_array_mult(IrAnalyze *ira, IrInstructionBinOp | ... | @@ -11881,10 +11941,14 @@ static TypeTableEntry *ir_analyze_array_mult(IrAnalyze *ira, IrInstructionBinOp |
| 11881 | } | 11941 | } |
| 11882 | | 11942 | |
| 11883 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); | 11943 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); |
| | 11944 | if (array_val->data.x_array.special == ConstArraySpecialUndef) { |
| | 11945 | out_val->data.x_array.special = ConstArraySpecialUndef; |
| 11884 | | 11946 | |
| 11885 | out_val->data.x_array.s_none.elements = create_const_vals(new_array_len); | 11947 | TypeTableEntry *child_type = array_type->data.array.child_type; |
| | 11948 | return get_array_type(ira->codegen, child_type, new_array_len); |
| | 11949 | } |
| 11886 | | 11950 | |
| 11887 | expand_undef_array(ira->codegen, array_val); | 11951 | out_val->data.x_array.s_none.elements = create_const_vals(new_array_len); |
| 11888 | | 11952 | |
| 11889 | uint64_t i = 0; | 11953 | uint64_t i = 0; |
| 11890 | for (uint64_t x = 0; x < mult_amt; x += 1) { | 11954 | for (uint64_t x = 0; x < mult_amt; x += 1) { |
| ... | @@ -13211,7 +13275,11 @@ static TypeTableEntry *ir_analyze_dereference(IrAnalyze *ira, IrInstructionUnOp | ... | @@ -13211,7 +13275,11 @@ static TypeTableEntry *ir_analyze_dereference(IrAnalyze *ira, IrInstructionUnOp |
| 13211 | // one of the ptr instructions | 13275 | // one of the ptr instructions |
| 13212 | | 13276 | |
| 13213 | if (instr_is_comptime(value)) { | 13277 | if (instr_is_comptime(value)) { |
| 13214 | ConstExprValue *pointee = const_ptr_pointee(ira->codegen, &value->value); | 13278 | ConstExprValue *comptime_value = ir_resolve_const(ira, value, UndefBad); |
| | 13279 | if (comptime_value == nullptr) |
| | 13280 | return ira->codegen->builtin_types.entry_invalid; |
| | 13281 | |
| | 13282 | ConstExprValue *pointee = const_ptr_pointee(ira->codegen, comptime_value); |
| 13215 | if (pointee->type == child_type) { | 13283 | if (pointee->type == child_type) { |
| 13216 | ConstExprValue *out_val = ir_build_const_from(ira, &un_op_instruction->base); | 13284 | ConstExprValue *out_val = ir_build_const_from(ira, &un_op_instruction->base); |
| 13217 | copy_const_val(out_val, pointee, value->value.data.x_ptr.mut == ConstPtrMutComptimeConst); | 13285 | copy_const_val(out_val, pointee, value->value.data.x_ptr.mut == ConstPtrMutComptimeConst); |
| ... | @@ -13328,7 +13396,7 @@ static TypeTableEntry *ir_analyze_bin_not(IrAnalyze *ira, IrInstructionUnOp *ins | ... | @@ -13328,7 +13396,7 @@ static TypeTableEntry *ir_analyze_bin_not(IrAnalyze *ira, IrInstructionUnOp *ins |
| 13328 | if (expr_type->id == TypeTableEntryIdInt) { | 13396 | if (expr_type->id == TypeTableEntryIdInt) { |
| 13329 | if (instr_is_comptime(value)) { | 13397 | if (instr_is_comptime(value)) { |
| 13330 | ConstExprValue *target_const_val = ir_resolve_const(ira, value, UndefBad); | 13398 | ConstExprValue *target_const_val = ir_resolve_const(ira, value, UndefBad); |
| 13331 | if (!target_const_val) | 13399 | if (target_const_val == nullptr) |
| 13332 | return ira->codegen->builtin_types.entry_invalid; | 13400 | return ira->codegen->builtin_types.entry_invalid; |
| 13333 | | 13401 | |
| 13334 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); | 13402 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); |
| ... | @@ -17908,9 +17976,13 @@ static TypeTableEntry *ir_analyze_instruction_bool_not(IrAnalyze *ira, IrInstruc | ... | @@ -17908,9 +17976,13 @@ static TypeTableEntry *ir_analyze_instruction_bool_not(IrAnalyze *ira, IrInstruc |
| 17908 | if (type_is_invalid(casted_value->value.type)) | 17976 | if (type_is_invalid(casted_value->value.type)) |
| 17909 | return ira->codegen->builtin_types.entry_invalid; | 17977 | return ira->codegen->builtin_types.entry_invalid; |
| 17910 | | 17978 | |
| 17911 | if (casted_value->value.special != ConstValSpecialRuntime) { | 17979 | if (instr_is_comptime(casted_value)) { |
| | 17980 | ConstExprValue *value = ir_resolve_const(ira, casted_value, UndefBad); |
| | 17981 | if (value == nullptr) |
| | 17982 | return ira->codegen->builtin_types.entry_invalid; |
| | 17983 | |
| 17912 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); | 17984 | ConstExprValue *out_val = ir_build_const_from(ira, &instruction->base); |
| 17913 | out_val->data.x_bool = !casted_value->value.data.x_bool; | 17985 | out_val->data.x_bool = !value->data.x_bool; |
| 17914 | return bool_type; | 17986 | return bool_type; |
| 17915 | } | 17987 | } |
| 17916 | | 17988 | |